本文整理汇总了Python中extractor.Extractor.connectToAPI方法的典型用法代码示例。如果您正苦于以下问题:Python Extractor.connectToAPI方法的具体用法?Python Extractor.connectToAPI怎么用?Python Extractor.connectToAPI使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类extractor.Extractor
的用法示例。
在下文中一共展示了Extractor.connectToAPI方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_user_tweets
# 需要导入模块: from extractor import Extractor [as 别名]
# 或者: from extractor.Extractor import connectToAPI [as 别名]
def get_user_tweets(self,hashtaglist):
ext= Extractor()
auth = ext.loadtokens()
api = ext.connectToAPI(auth)
for ht in hashtaglist:
full_tweets = ext.gettweets_hashtag(ht,api)
ext.printcsv(full_tweets,ht)
示例2: Extractor
# 需要导入模块: from extractor import Extractor [as 别名]
# 或者: from extractor.Extractor import connectToAPI [as 别名]
top_RT.append(t)
tweets.sort(key=lambda x:int(x[3]), reverse=True)
##Create list of most followed users##
for t in tweets:
if (t[0] not in temp2) and (len(most_followed) < 200):
temp2.append(t[0])
most_followed.append([t[0], t[3]])
ext= Extractor()
auth = ext.loadtokens()
api = ext.connectToAPI(auth)
id_list=[]
print ("Getting ID of most retweeted tweets...")
## Get the ID of the most retweeted tweets and put them in a list##
## If tweet starts with 'RT', meaning it is a retweet, then get the ID of the original tweet ##
for t in top_RT:
if (t[7].startswith('RT')) or (t[7].startswith('"RT')):
tweet=api.get_status(id=int(t[1]))
#dumps serialises strings into JSON (which is very similar to python's dict)
json_str= json.dumps(tweet._json)