YoutubeのAPIを使ってデータを取得するパッケージ
- Python (>= 3.4)
pip install git+https://github.com/9en/YoutubeAPI
- Description:
- コメント一覧を取得する(コメントの返信は含まない)
- Retern:
- 動画を公開した日付(YYYY-MM-DD)
- Param::
- get_dt:
- True / False(デフォルト)
- 動画公開日(YYYY-MM-DD)を取得する
- get_dt:
- Output:
- ファイル名:output_comment.tsv
- カレントディレクトに出力する
- カラム(reference):
- dt
- publishedAt
- id,videoId
- authorDisplayName
- authorChannelId
- likeCount
- totalReplyCount
- textDisplay
Sample::
>>> import YoutubeAPI
>>> video_id = 'SjQaPt68o0M'
>>> config_filename = 'config.ini'
>>> yt = YoutubeAPI.YoutubeAPI(video_id, config_filename, token)
>>> yt.get_comment_data()
extract 0 page (100comment/1page)
extract 1 page (100comment/1page)
extract 2 page (100comment/1page)
extract 3 page (100comment/1page)
extract 4 page (100comment/1page)
extract 5 page (100comment/1page)
extract 6 page (100comment/1page)
extract 7 page (100comment/1page)
extract 8 page (100comment/1page)
extract 9 page (100comment/1page)
- Description:
- 動画の基礎数値
- Retern:
- 動画を公開した日付(YYYY-MM-DD)
- Param::
- get_dt:
- True / False(デフォルト)
- 動画公開日(YYYY-MM-DD)を取得する
- get_dt:
- Output:
- ファイル名:output_video.tsv
- カレントディレクトに出力する
- カラム(reference):
- dt
- publishedAt
- channelId
- channelTitle
- videoId
- title
- thumbnails
- tags
- viewCount
- likeCount
- dislikeCount
- favoriteCount
- commentCount
Sample::
>>> import YoutubeAPI
>>> video_id = 'SjQaPt68o0M'
>>> config_filename = 'config.ini'
>>> yt = YoutubeAPI.YoutubeAPI(video_id, config_filename, token)
>>> yt.get_video_data()
<APIトークン>
はこちらのサイトを参考にから取得する
[settings]
URL: https://www.googleapis.com/youtube/v3/
[commentThreads]
part: snippet
order: relevance
textFormat: plaintext
maxResults: 100
[videos]
part: snippet,statistics