Hi all i would like to get a list of trending topic from a specific country.
You can look at the documentation here.
The format of the feed is
api.twitter.com/1/trends/woeid.format
When searching for trends in London(WEOIP=44418) it works perfectly.
api.twitter.com/1/trends/44418.json
But for some reason it does not work for South Africa(WEOIP=23424942)
api.twitter.com/1/trends/23424942.json
Trending data is available for certain countries, but it is not available for South Africa.
There is a list of available locations (which may be out of date, posted on February 4, 2010) at the bottom of this blog post:
https://blog.twitter.com/engineering/en_us/a/2010/woeids-in-twitters-trends.html
Twitter API provides a method to get available locations for trending topics. You should first fetch those available locations and then make a request to load trending topics for one of those locations by specifying its WOEID. See Twitter API reference for available locations.
Related
I am trying to get the trending hashtags and keywords for certain countries. Now I know that there is Twitter API and I've been using Twitter API V2, where there is no API call that will allow us to extract the trending hashtags for specific countries.
I then used Twitter V1 to extract the list of trending hashtags, but I realised that some countries are missing (For example, Iraq).
But what was intriguing was the fact, if you go to the settings section and choose to show the trends according to a location of your choice and you choose Iraq, you will get a list of the most trending hashtags for Iraq.
I tried to automate this using Selenium. It worked locally, but I faced issues when I tried to deploy it on a server. I used XFVB to run chrome and selenium on my Linux server but for some reason after a while, the automation process stops as I'm taken suddenly back into the login page.
Does any know of any alternative way, where I can extract the trending hashtags for countries such as Tunisia, Iraq or Algeria. Countries that are not part of the countries listed as part of the Twitter V1, but are available if you manually pick the location you want the trends to be showcased. (https://twitter.com/settings/trends, this URL in the explore locations option, you can pick your country. Here you can find Iraq among other countries)
I am looking for a way to get top-50 most popular videos from Explore Tab for a specific date or a period of time for a specific country. Can't find a way how to do it in YouTube API Documentation. Is there a way? If not, maybe you know some workarounds for getting a historical data?
For example, I could build a web scraper that would collect trending videos from Wayback Machine but it shows trending videos in the U.S. only.
Also, found YouTube Charts website, but it shows only music.
As far as I know, there is no such public endpoint or public resource to get these results - besides Wayback Machine and the public/official YouTube channels you can find on their website.
However, since you mentioned using Wayback Machine, you could follow these steps:
Enter to Wayback Machine and search for results about the Pouplar on YouTube channel - see example of extract from Jun 15, 20211.
Retrieve the videos shown in the search results from step 1.
That being said, I recommend you to start creating a database for record trending videos everyday - not sure how you can do this by region, though (this is due there are trending videos by "main countries" like UK, India, some parts of Asia, France, but, as I searched, trending applies for ALL countries) - if I'm wrong in this, please, let me know.
Another possible way to get close results to your expectations could be:
Enter to Popular on YouTube channel and check the Popular now playlist.2
Retrieve those results and organize the results - with this, I mean: check the publication date, check the channel's country/location, etc. It's up to you to check how to organize the available data.
1 Please check that probably there is no data/snapshot on a given day you require - using Wayback Machine -.
2 According to the updated date, this playlist is updated everyday, so, you have to make the same procedure mentioned above (create a database that store results everyday, etc.).
Not sure if with an VPN you can set the VPN and try to get the "Popular now" videos from the selected VPN country, might worth give it a try.
Try also contact with YouTube - probably you might get some sort of answer, ask them if they can provide information about trending videos from a specific region - in a specific time.
TL;DR: I want to be able to retrieve the N most popular tweets for any arbitrary country within the last X hours (up to 24 hours)
More detail
I want to show the details of the most popular tweets by geographic region (country) over the past few hours (adjustable up to 24 hours). How can I use the Twitter REST API to achieve this (v1.1 or v2)?
There are endpoints for querying tweets and filtering by popularity, but they require a search string (e.g. "NASA") and return the most popular tweets matching that search string. I am not interested in the contents of the tweets, I just want to know what is most popular.
I plan on using this functionality to show a world map (using Leaflet) to summarise the most popular tweets by country for the past day.
I am using Twit in NodeJS but not looking for answers specific to Node, rather how to leverage the capabilities of the API.
I am not aware of a way that this can be done directly through the API itself (V1 or V2). I also do not think that this is going to be a trivial task at all.
What I would suggest is using the search endpoint...
V1: Reference
V2: Reference Note that to use geolocation search parameters (see below) you'll need academic access.
... in conjunction with one of the geolocation search parameters. For example, you could pull some subset of tweets from within a country (you will not be able to download all tweets within a single country on any given day, not to mention all countries). After you get this data, you'll need to do some of your own data processing based on how you want to define "popular" (e.g. retweets, likes, etc.) and then go from there.
As I said earlier, this seems like a very large project and not something that can be solved simply with the Twitter API.
i'm University students of South korea
I'm developing analysis application using bigdata of twitter with my advisor professor. So i'm gathering tweets contains specific keyword(relevant word of crime) at period. I use 'streaming api' and 'search api' now. I have seen that using search api and streaming api result is return tweets of only one week.
I should be get the old data that have keyword of crime and since 2006 until 2016
do you have any idea?
Sadly you can't get tweets from that time range.
From the documentation:
The Search API is not complete index of all Tweets, but instead an index of recent Tweets. At the moment that index includes between 6-9 days of Tweets.
So, you can only get recent tweets from the search API. Be careful too with the data beacuse it's about relevance not completeness, from the same documentation:
Before getting involved, it’s important to know that the Search API is focused on relevance and not completeness. This means that some Tweets and users may be missing from search results. If you want to match for completeness you should consider using a Streaming API instead.
If you really need older tweets you will have to get them from other sources like Gnip. Otherwise you will have to approach differently your problem.
If you have the names (or id's) of all the users that you want to get info you could get the timelines from each user getting up to 3200 tweets.
This is a question about the Twitter API, which doesn't provide any information on this issue.
It's possible to get the current trending topic for a location, for example: United States:
https://api.twitter.com/1/trends/23424977.json
where 23424977 is the location code for the United States.
It's also possible to get the hourly trending topic for a given day, but world-wide:
https://api.twitter.com/1/trends/daily.json?date=2012-06-10/
However, I have not been able to find out how to get the trending topics on a given day in a given location, that is, a way to combine these two separate calls together.
Anyone has a solution to this?
Thanks.
You can't get this information from twitter API directly. You must regularly query the locations you are interested in for current trends. If you are interested in covering the globe, then you will need some oAuth drones to get past 150/350 request limit per hour.
And then in no time you will have your own archive of trending topics.