本文整理匯總了Python中extractor.Extractor.loadtokens方法的典型用法代碼示例。如果您正苦於以下問題:Python Extractor.loadtokens方法的具體用法?Python Extractor.loadtokens怎麽用?Python Extractor.loadtokens使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類extractor.Extractor
的用法示例。
在下文中一共展示了Extractor.loadtokens方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_user_tweets
# 需要導入模塊: from extractor import Extractor [as 別名]
# 或者: from extractor.Extractor import loadtokens [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 loadtokens [as 別名]
temp.append(t[7])
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)