brainydexter
brainydexter

Reputation: 20346

how can I retrieve tweets with URLs from a user's stream?

I have oAuth in place using Jaisen Mathai Epi PHP library.

How can I retrieve tweets with URLs from a user's stream ? (capped by 300 tweets) ?

I am very new to this and found out that search api only yields last 5 days results, so I can't use the search api anymore.

how can I retrieve such filtered data ?

Upvotes: 1

Views: 798

Answers (1)

Chamilyan
Chamilyan

Reputation: 9423

You shouldn't use Regex and you don't have to use the streaming API. Twitter has built in methods in it's REST api to handle the issue.

to capture the Tweet URL's in your search:

Add the parameter include_entities=1 to the end of your API call.

Tweet entities

You will get back an extended JSON with the expanded and short URL versions and their positions in the tweet.

"urls": [
        {
          "url": "http://t.co/0JG5Mcq",
          "display_url": "blog.twitter.com/2011/05/twitte…",
          "expanded_url": "http://blog.twitter.com/2011/05/twitter-for-mac-update.html",
          "indices": [
            84,
            103
          ]
        }
      ],

The cap limit on the Twitter API is 100 tweets and 10 days. On some calls it's 20 tweets. What you will want to do is use an API that circumvents the search limit. Snapbird is the most popular solution for this.

Snapbird API

Upvotes: 3

Related Questions