def got_words(target): words = [] for t in twt_get(target)['statuses']: text = t['text'] #print(text) words = words + Titles.get_titles(text) words = sorted(words) #print(words) return words
def got_words(target): words = [] for t in twt_get(target)['statuses']: text = t['text'] #print(text) words = words + Titles.get_titles(text) words = sorted(words) #print(words) return words
def got_words(sample): words = [] for s in sample: while True: twt = twt_get(s) if len(twt) != 0: break print("#### Waiting 15 minutes to recover access limit ####") wait_m = 5 time.sleep(wait_m * 60) for t in twt['statuses']: #print(t) text = t['text'] #print(text) words = words + Titles.get_titles(text) words = sorted(words) #print(words) return words
def got_words(sample): words = [] for s in sample: while True: twt = twt_get(s) if len(twt) != 0: break print("#### Waiting 15 minutes to recover access limit ####") wait_m = 5 time.sleep(wait_m * 60) for t in twt['statuses']: #print(t) text = t['text'] #print(text) words = words + Titles.get_titles(text) words = sorted(words) #print(words) return words
#start = "有川浩" start = "読売新聞" #start = "高橋" #start = "僕は友達が少ない" target = "井上麻里奈" #text = Text.get_wiki(start)[2] ## [id,title,text] #words = Titles.get_titles(text) #print(words) routes = [] result = ["### ERROR ###"] routes.append([start]) target_text = Text.get_wiki(target)[2] ## [id,title,text] target_words = list(set(Titles.get_titles(target_text))) f_name = target + "(text).txt" f = open(f_name, 'w') # 書き込みモードで開く f.write(target_text) # 引数の文字列をファイルに書き込む f.close() # ファイルを閉じる f_name = target + "(words).txt" f = open(f_name, 'w') # 書き込みモードで開く f.write("\n".join(target_words)) # 引数の文字列をファイルに書き込む f.close() # ファイルを閉じる print(target_text) print("================================================================\n") print(target_words)
#start = "有川浩" start = "読売新聞" #start = "高橋" #start = "僕は友達が少ない" target = "井上麻里奈" #text = Text.get_wiki(start)[2] ## [id,title,text] #words = Titles.get_titles(text) #print(words) routes = [] result = ["### ERROR ###"] routes.append([start]) target_text = Text.get_wiki(target)[2] ## [id,title,text] target_words = list(set(Titles.get_titles(target_text))) f_name = target + "(text).txt" f = open(f_name, 'w') # 書き込みモードで開く f.write(target_text) # 引数の文字列をファイルに書き込む f.close() # ファイルを閉じる f_name = target + "(words).txt" f = open(f_name, 'w') # 書き込みモードで開く f.write("\n".join(target_words)) # 引数の文字列をファイルに書き込む f.close() # ファイルを閉じる print(target_text) print("================================================================\n") print(target_words)