I have got the trends available for a location in India using trends/available API
{
'name': 'Bhopal',
'placeType': {
'code': 7,
'name': 'Town'
},
'url': 'http://where.yahooapis.com/v1/place/2295407',
'parentid': 23424848,
'country': 'India',
'woeid': 2295407,
'countryCode': 'IN'
},
{
'name': 'Indore',
'placeType': {
'code': 7,
'name': 'Town'
},
'url': 'http://where.yahooapis.com/v1/place/2295408',
'parentid': 23424848,
'country': 'India',
'woeid': 2295408,
'countryCode': 'IN'
},
{
'name': 'Thane',
'placeType': {
'code': 7,
'name': 'Town'
},
'url': 'http://where.yahooapis.com/v1/place/2295410',
'parentid': 23424848,
'country': 'India',
'woeid': 2295410,
'countryCode': 'IN'
},
{
'name': 'Mumbai',
'placeType': {
'code': 7,
'name': 'Town'
},
'url': 'http://where.yahooapis.com/v1/place/2295411',
'parentid': 23424848,
'country': 'India',
'woeid': 2295411,
'countryCode': 'IN'
},
{
'name': 'Pune',
'placeType': {
'code': 7,
'name': 'Town'
I am passing different woeid in the code twitter_api.trends.place(_id=town_woeid) and it gives same trending topics for each of the town woeid using /trends/place api
Here is part of the code which does this.
woids = {'Nagpur':2295412, 'Lucknow':2295377,'Kanpur':2295378, 'Patna':2295381, 'Ranchi':2295383,'Kolkata':2295386, 'Srinagar':2295387, 'Amritsar':2295388,\
'Jaipur':2295401,'Ahmedabad':2295402, 'Rajkot':2295404, 'Surat':2295405, 'Bhopal':2295407, 'Indore':2295408, 'Thane':2295410, 'Mumbai':2295411, 'Pune':2295412,\
'Hyderabad':2295414, 'Bangalore':2295420, 'Chennai':2295424}
for key in woids.keys():
print(key, " id: ", woids[key])
trends = self.twitter_api.trends.place(_id=woids[key])
print("--------called api ---------- ", trends)
with open(key+"_Trending.txt", "w+") as f:
for trending in trends[0]['trends']:
print(trending['name'], '-----', trending['tweet_volume'])
f.write(trending['name']+ '-----'+str(trending['tweet_volume']))
f.write("\n")
Here is the same result for each town. But it should give different trending topics for each of the town, right?
#RiyazNaikoo ----- 69420
X Æ A-12 ----- 977101
#IUxSUGA ----- 1635605
#HumModiKeSathHain ----- 23887
#IndiaHealthHour ----- None
#सफूरा_जरगर_मेरी_बहन_है ----- 127206
Justice 4 Sea ----- None
मौत मारा ----- 14506
Joonie ----- 25503
slavery ----- 31570
Top Hizbul ----- None
Most Photogenic Star ----- None
Rs 1,610 ----- None
Mysuru ----- None
Anna Hazare ----- None
Kamal Hassan ----- None
#BeingHaangryy ----- 12197
#boislockeroom ----- None
#हंसराज_का_जीजा_कौन_है ----- 19033
#BJPTheRealAntiNational ----- 10857
#गद्दार_मोदी_लुटेरा_है ----- 72618
#पप्पू_तो_गद्दार_है ----- 81990
#GoldQuarantineAwards ----- None
#HizbulMujahideen ----- None
#SidHeartsWishHBDVinduSir ----- 51926
#EXWeek ----- None
#eightiscoming ----- 129374
#भगवा_शेर_योगी_जी ----- None
#SenaKaBadla ----- None
#Thalapathy65 ----- 17290
#MODIJI_HelpUs ----- 123497
#ArrestSwatiMaliwal ----- None
#TerrorismFreeKashmir ----- None
#NarasimhaJayanti ----- None
#TTVcondemnsTASMACopening ----- None
#HBDSundeepKishan ----- None
#आरक्षण_के_जनक ----- 60779
#ஊழலின்_புகலிடம்_அதிமுக ----- 12779
#JassieGill ----- None
#4YearsOfAwestruck24Movie ----- 50243
#भारतीय_सेना ----- None
#JaiHindKiSena ----- None
#ILoveRedmiNote ----- None
#ShameOnYouFadanvis ----- None
Lucknow id: 2295377
Can anybody tell me if I am doing something wrong? or is it cache issue from twitter side? Thanks.
It is perfectly possible that trends will not be different for each individual location within a country. It depends on the level at which Twitter trends are being logged. The Trends API is different to the trends that you see on the Twitter user interface, as the UI has personalised data based on the logged-in user. If you do see different data between towns on some days, then I'd agree with your suggestion that it might be a temporary caching issue, but otherwise, I would think that this is potentially the expected behaviour.