質問編集履歴
1
title
CHANGED
File without changes
|
body
CHANGED
@@ -14,24 +14,30 @@
|
|
14
14
|
※ツイッターAPIの××××のみ任意のものに変更しています。
|
15
15
|
|
16
16
|
|
17
|
+
```ここに言語を入力
|
17
18
|
import tweepy
|
18
19
|
|
19
20
|
def api():
|
21
|
+
|
22
|
+
|
20
|
-
|
23
|
+
consumer_key = '××××'
|
21
|
-
|
24
|
+
consumer_secret = '××××'
|
22
|
-
|
25
|
+
access_key = '××××'
|
23
|
-
|
26
|
+
access_secret = '××××'
|
24
|
-
|
27
|
+
|
25
|
-
|
28
|
+
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
|
26
|
-
|
29
|
+
auth.set_access_token(access_key, access_secret)
|
27
|
-
|
30
|
+
api = tweepy.API(auth)
|
31
|
+
|
28
|
-
|
32
|
+
return api
|
33
|
+
|
29
|
-
|
34
|
+
dic={}
|
30
35
|
for tweet in api().search('通貨'):
|
31
|
-
|
36
|
+
text = tweet.text
|
32
|
-
|
37
|
+
id = tweet.id
|
33
|
-
|
38
|
+
dic.update({id:text})
|
34
|
-
|
39
|
+
if '@' in dic[id]:
|
35
|
-
|
40
|
+
pass
|
36
|
-
|
41
|
+
else:
|
37
|
-
|
42
|
+
api().create_favorite(id)
|
43
|
+
```
|