Is there a way to get tweets randomly from Twitter by specifying a user ID and hashtag?

Asked 2 years ago, Updated 2 years ago, 70 views

Looking for a way to get only one random tweet with a specific hashtag from the specified user tweets.

I looked at the REST API documentation on Twitter, and it seemed that there was no API that could achieve this.
Even if you don't use the Twitter API, please let me know if there is a good way.

By the way, I am thinking about creating an Android app using the above.

android twitter

2022-09-29 22:23

1 Answers

You can do this by throwing a search query containing a screen name and hashtag such as from:jack#ImWithKap into the search API (search/tweets) and randomly selecting the results.

However,

  • Search API samples for a week in the neighborhood
  • Up to 100 per request

You need to be careful because there are restrictions such as .
(The former limitation can be avoided on the CK-only endpoint of the official app, but we will omit it here.)

The Search API—Twitter Developers

(It may be possible to scrap searches for external log services such as twilog on the assumption that you have already registered, but I don't recommend it.)


2022-09-29 22:23

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.