teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

行ったことを追記しました。

2018/12/28 02:14

投稿

yukifujiwara
yukifujiwara

スコア11

title CHANGED
File without changes
body CHANGED
@@ -1,26 +1,18 @@
1
1
  pythonとfull archive premium APIを用いて、Tweetを取得しようとしています。
2
2
 
3
3
  利用しているPC:windows 10 pro
4
- anaconda3をウエブからダウンロードしました。
4
+ anaconda3をウエブからダウンロード
5
5
  pythonのバージョン:3.7.0
6
6
 
7
- **python searchtweetsパッケージ** [GitHub](https://github.com/twitterdev/search-tweets-python)を参考にしているのですが、上手くいきません。
7
+ **python searchtweetsパッケージ** [GitHub]のサイトを参考にしているのですが、上手くいきません。
8
8
 
9
- 質問は、
10
- 0. YAMLファイルはどこに保存すればよいか
11
- 0. コードはコマンドプロンプトに打つのか
12
- 0. 出力したファイルはどこにあるのか
13
-
14
-  以上の3つです。
15
- 慣れておらず、的外れな質問ばかりかもしれませんが、よろしくお願いします。
16
-
17
9
  ---
18
10
 
19
11
  - 試しに30days sandbox APIを利用して、12/1に投稿された「iphone」を含むツイートを取得しようとしました。
20
12
 
21
13
  twitter_keys.yaml という名前のファイルを作成し、以下のコードを打ちました。
22
14
  ()の中は私のconsumer keyなどを入力しています。
23
- 保存場所がわからず、Anaconda3ファイルの中に入れています。
15
+ Anaconda3ファイルの中に保存しています。
24
16
  ```
25
17
  search_tweets_api:
26
18
  account_type: premium
@@ -28,15 +20,21 @@
28
20
  consumer_key: <()>
29
21
  consumer_secret: <()>
30
22
  ```
23
+ 以下をコマンドプロンプトに入力しました。
24
+ ```
25
+ python search_tweets.py --max-results 100 --results-per-call 100 --filter-rule "iPhone lang:ja since:2018-12-01 until:2018-12-02" ---filename-prefix test_search --print-stream
26
+ ```
27
+ すると"can't open file 'search_tweets.py': [Errno 2] No such file or directory"と表示されます。
28
+ ![イメージ説明](c4821874c0b45852c1ea8f3606e104b5.png)
31
29
 
32
-
30
+ ---
33
31
  以下をコマンドプロンプトに入力しました。
34
32
  ```
35
33
  search_tweets.py --max-results 100 --results-per-call 100 --filter-rule "iPhone lang:ja since:2018-12-01 until:2018-12-02" ---filename-prefix test_search --print-stream
36
34
  ```
37
35
 
38
36
  すると以下の画面が開きます。(長いです)
39
- 開く画面は、左上に「Python 2.7.8: search_tweews.py - C:\Users\SOCIAL002\Anaconda3\Scripts\search_tweets.py」と表示されている白い画面です。(python Shellというものでしょうか、、、)
37
+ 開く画面は、左上に「Python 2.7.8: search_tweews.py - C:\Users\SOCIAL002\Anaconda3\Scripts\search_tweets.py」と表示されている白い画面です。(python Shell)
40
38
  ```
41
39
  #!c:\users\social002\anaconda3\python.exe
42
40
  # Copyright 2017 Twitter, Inc.
@@ -103,75 +101,10 @@
103
101
  choices=["premium", "enterprise"],
104
102
  help="The account type you are using")
105
103
 
106
- argparser.add_argument("--count-bucket",
104
+ .
107
- dest="count_bucket",
105
+ .
108
- default=None,
106
+ .(文字制限を超えるため中略)
109
- help=("""Bucket size for counts API. Options:,
110
- day, hour, minute (default is 'day')."""))
111
107
 
112
- argparser.add_argument("--start-datetime",
113
- dest="from_date",
114
- default=None,
115
- help="""Start of datetime window, format
116
- 'YYYY-mm-DDTHH:MM' (default: -30 days)""")
117
-
118
- argparser.add_argument("--end-datetime",
119
- dest="to_date",
120
- default=None,
121
- help="""End of datetime window, format
122
- 'YYYY-mm-DDTHH:MM' (default: most recent
123
- date)""")
124
-
125
- argparser.add_argument("--filter-rule",
126
- dest="pt_rule",
127
- default=None,
128
- help="PowerTrack filter rule (See: http://support.gnip.com/customer/portal/articles/901152-powertrack-operators)")
129
-
130
- argparser.add_argument("--results-per-call",
131
- dest="results_per_call",
132
- help="Number of results to return per call "
133
- "(default 100; max 500) - corresponds to "
134
- "'maxResults' in the API")
135
-
136
- argparser.add_argument("--max-results", dest="max_results",
137
- type=int,
138
- help="Maximum number of Tweets or Counts to return for this session")
139
-
140
- argparser.add_argument("--max-pages",
141
- dest="max_pages",
142
- type=int,
143
- default=None,
144
- help="Maximum number of pages/API calls to "
145
- "use for this session.")
146
-
147
- argparser.add_argument("--results-per-file", dest="results_per_file",
148
- default=None,
149
- type=int,
150
- help="Maximum tweets to save per file.")
151
-
152
- argparser.add_argument("--filename-prefix",
153
- dest="filename_prefix",
154
- default=None,
155
- help="prefix for the filename where tweet "
156
- " json data will be stored.")
157
-
158
- argparser.add_argument("--no-print-stream",
159
- dest="print_stream",
160
- action="store_false",
161
- help="disable print streaming")
162
-
163
- argparser.add_argument("--print-stream",
164
- dest="print_stream",
165
- action="store_true",
166
- default=True,
167
- help="Print tweet stream to stdout")
168
-
169
- argparser.add_argument("--extra-headers",
170
- dest="extra_headers",
171
- type=str,
172
- default=None,
173
- help="JSON-formatted str representing a dict of additional request headers")
174
-
175
108
  argparser.add_argument("--debug",
176
109
  dest="debug",
177
110
  action="store_true",

1

基本的な情報(pythonのバージョンなど)の追加/困っていることをさらに詳細に書きました。

2018/12/28 02:14

投稿

yukifujiwara
yukifujiwara

スコア11

title CHANGED
File without changes
body CHANGED
@@ -1,5 +1,9 @@
1
1
  pythonとfull archive premium APIを用いて、Tweetを取得しようとしています。
2
2
 
3
+ 利用しているPC:windows 10 pro
4
+ anaconda3をウエブからダウンロードしました。
5
+ pythonのバージョン:3.7.0
6
+
3
7
  **python searchtweetsパッケージ** [GitHub](https://github.com/twitterdev/search-tweets-python)を参考にしているのですが、上手くいきません。
4
8
 
5
9
  質問は、
@@ -32,6 +36,7 @@
32
36
  ```
33
37
 
34
38
  すると以下の画面が開きます。(長いです)
39
+ 開く画面は、左上に「Python 2.7.8: search_tweews.py - C:\Users\SOCIAL002\Anaconda3\Scripts\search_tweets.py」と表示されている白い画面です。(python Shellというものでしょうか、、、)
35
40
  ```
36
41
  #!c:\users\social002\anaconda3\python.exe
37
42
  # Copyright 2017 Twitter, Inc.