How do I Fetch Twitter Share Count via PHP after t

2020-03-04 08:51发布

Twitter just announced that they are closing the private JSON endpoints. However they mentioned using these two other sources to collect Twitter data:

https://dev.twitter.com/rest/reference/get/search/tweets http://support.gnip.com/apis/search_full_archive_api/overview.html

Can either of these (or some other source) be used to collect the Twitter share count of a URL? If so, how?

标签: php twitter
2条回答
Emotional °昔
2楼-- · 2020-03-04 09:33

Twitter's search interface can be used to find tweets linking to a URL, by searching for it as a quoted string without the http[s]://www. prefix:

https://twitter.com/search?f=tweets&q="bbc.co.uk/programmes/b039ctgc"

The number of tweets in the search results, plus the count of each of their retweets, should give a similar count to that returned by the previous "share count" URL.

Note: there are caveats, such as it not being a true URL search, so a similar URL that happens to contain the same string will also match and be included in the search results.

Here's the same search via Twitter's search API (note: requires authentication) - you can also test it in the API console.

查看更多
\"骚年 ilove
3楼-- · 2020-03-04 09:43

You can also try http://opensharecount.com, they provide a drop-in replacement for the old private JSON URL based on searches made via the API (so you don't need to do all that work). You need to register to activate it for your domain though.

查看更多
登录 后发表回答