回答編集履歴
6
些細
test
CHANGED
@@ -54,4 +54,4 @@
|
|
54
54
|
|
55
55
|
```
|
56
56
|
|
57
|
-
のようにすれば「15分間に5000件を15回、最大75,000件獲得」になりますね。
|
57
|
+
のようにすれば「15分間に5000件を15回、最大75,000件、IDのみを獲得」になりますね。
|
5
誤解のないように修正
test
CHANGED
@@ -22,13 +22,17 @@
|
|
22
22
|
|
23
23
|
followers_ids = tweepy.Cursor(api.followers_ids, id = target_id, cursor = -1).items()
|
24
24
|
|
25
|
+
|
26
|
+
|
27
|
+
for followers_id in followers_ids:
|
28
|
+
|
25
29
|
```
|
26
30
|
|
27
31
|
**この部分(=followers/ids)に対する**実行の制限が「15分に15回」で「API実行1回につき5,000件」までです。 [APIリファレンス](https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-followers-ids#resource-information)
|
28
32
|
|
29
33
|
|
30
34
|
|
31
|
-
|
35
|
+
`target_id`で指定されたアカウントのフォロワーが5,000より多い時に、この部分でAPIが複数回実行されます。
|
32
36
|
|
33
37
|
|
34
38
|
|
4
コードの体裁の修正
test
CHANGED
@@ -40,13 +40,11 @@
|
|
40
40
|
|
41
41
|
```python
|
42
42
|
|
43
|
-
followers_ids = tweepy.Cursor(api.followers_ids, id = target_id, cursor = -1).items()
|
44
|
-
|
45
43
|
|
46
44
|
|
47
45
|
with open('xxxxxxxx.followers.txt', 'a') as f:
|
48
46
|
|
49
|
-
for user_id in followers_ids:
|
47
|
+
for user_id in tweepy.Cursor(api.followers_ids, id=target_id, cursor=-1).items():
|
50
48
|
|
51
49
|
print(user_id, file=f)
|
52
50
|
|
3
些細
test
CHANGED
@@ -52,4 +52,4 @@
|
|
52
52
|
|
53
53
|
```
|
54
54
|
|
55
|
-
のようにすれば「15分間に5000件を15回、
|
55
|
+
のようにすれば「15分間に5000件を15回、最大75,000件獲得」になりますね。
|
2
些細
test
CHANGED
@@ -18,7 +18,7 @@
|
|
18
18
|
|
19
19
|
質問のソースの
|
20
20
|
|
21
|
-
```
|
21
|
+
```python
|
22
22
|
|
23
23
|
followers_ids = tweepy.Cursor(api.followers_ids, id = target_id, cursor = -1).items()
|
24
24
|
|
1
追記
test
CHANGED
@@ -7,3 +7,49 @@
|
|
7
7
|
|
8
8
|
|
9
9
|
Twitter API が15分に900回までしか受け付けないのでそれが上限です。
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
----
|
14
|
+
|
15
|
+
コメントに対して
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
質問のソースの
|
20
|
+
|
21
|
+
```
|
22
|
+
|
23
|
+
followers_ids = tweepy.Cursor(api.followers_ids, id = target_id, cursor = -1).items()
|
24
|
+
|
25
|
+
```
|
26
|
+
|
27
|
+
**この部分(=followers/ids)に対する**実行の制限が「15分に15回」で「API実行1回につき5,000件」までです。 [APIリファレンス](https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-followers-ids#resource-information)
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
今ここで`target_id`の指定が1つですから、そのアカウントのフォロワーが5,000より多い時にはこの部分でAPIが複数回実行されます。しかしながら、下の`api.get_user(...)`の回数制限の方がきついのでfollowers/idsの制限は一切問題になりません。
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
----
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
たとえば
|
40
|
+
|
41
|
+
```python
|
42
|
+
|
43
|
+
followers_ids = tweepy.Cursor(api.followers_ids, id = target_id, cursor = -1).items()
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
with open('xxxxxxxx.followers.txt', 'a') as f:
|
48
|
+
|
49
|
+
for user_id in followers_ids:
|
50
|
+
|
51
|
+
print(user_id, file=f)
|
52
|
+
|
53
|
+
```
|
54
|
+
|
55
|
+
のようにすれば「15分間に5000件を15回、計75,000件獲得」になりますね。
|