0
votes

I want to fetch all the images from tweets with a certain hashtag within the last month. I'm currently using Ruby. In my index.rb file I'm trying to store the following code in a variable:

@photos = client.search('#bestfriends', { include_entities: true, fromDate:"201801071200>",toDate:"201802071200", include_entities: true })

However, when I run this on the command line I get the following:

{:statuses=>
    [{:created_at=>"Thu Feb 08 00:15:10 +0000 2018",
      :id=>961392929762938880,
      :id_str=>"961392929762938880",
      :text=>
       "FCC Says Releasing 'Jokes' It Wrote About Ajit Pai Illegally Colluding With Verizon (WHICH HAPPENED) Would 'Harm' A… ",
      :truncated=>true,
      :entities=>
       {:hashtags=>[],
        :symbols=>[],
        :user_mentions=>[],
        :urls=>

As you can see from :hashtags=>[], hashtags are empty, I there a way to fetch the tweets based on hashtags from a date range? I am using https://github.com/sferik/twitter but dont know if is better to use https://github.com/twitter/twurl since is from the command line.

1
This says “truncated: true” so you need to use the tweet_mode=extended parameter to retrieve the complete Tweet object including any entities. - Andy Piper
do I add tweet_mode=extended @AndyPiper in the query? I mean something like this:client.search('#bestfriends', { tweet_mode: extended, include_entities: true, fromDate:"201801071200>",toDate:"201802071200", include_entities: true }) - Steven Aguilar
That should work but I'm not familiar with the library you are using directly. - Andy Piper
@AndyPiper Can you have nested querying? meaning if I want to check that within :entities that :urls are not empty? - Steven Aguilar

1 Answers

0
votes

The filter you are looking for is has:hashtags but unfortunately it is only available in the premium and enterprise search.

https://developer.twitter.com/en/docs/tweets/search/api-reference/get-search-tweets.html

So unless you upgrade your app to premium, no library would return what you want directly.