1

I am using tweepy library to retrieve tweets containing specific link but it doesn't return anything.

Here is the code :

####input your credentials here
consumer_key = ''
consumer_secret = ''
access_token = ''
access_token_secret = ''

auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth,wait_on_rate_limit=True)


for tweet in tweepy.Cursor(api.search,q='www.democracynow.org/2018/4/18/americas_1_weapons_salesman_trump_promotes', count=10,
                           lang="en",
                           since="2017-04-03").items():
    print (tweet.created_at, tweet.text)

I tried the normal link and the encoded one but both didn't work. There is no error, it's just empty.

Is there a workaround ?

1 Answer 1

1

If you perform a search on Twitter's website for your query, you'll see that there are no results.
Instead, you're probably wanting to search for "https://www.democracynow.org/2018/4/18/americas_1_weapons_salesman_trump_promotes".

However, note that Twitter's standard search API has a limit of 7 days, and all the results for that search are much older than that. You'll have to use the premium or enterprise search APIs for older results.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.