Get YouTube data for analysis
Project description
Youtube-Info
Make YouTube queries and get information from videos (including captions, likes, titles, etc.) ready for Jupyter Notebooks.
Installation
pip install youtubeinfo
USAGE
Create a search object
import youtubeinfo.core as yt
yt_search = yt.search("Test", developer_key=<YOUR_YOUTUBE_DEVELOPER_KEY>)
yt_search.df # DataFrame with YouTube infos (likes, views, title, etc.)
Output example:
videoId | publishedAt | channelId | title | … | viewCount | likeCount | dislikeCount | favoriteCount | commentCount |
---|---|---|---|---|---|---|---|---|---|
abcde1234 | 2021-06-01 10:00:00+00:00 | abcde1234abc | Video title example 1 | … | 100000 | 6000 | 30 | 0 | 200 |
abcde1235 | 2021-06-01 11:00:00+00:00 | abcde1234abc | Video title example 2 | … | 200000 | 5000 | 40 | 1 | 210 |
abcde1236 | 2021-06-01 12:00:00+00:00 | abcde1234abd | Video title example 3 | … | 100000 | 4000 | 50 | 0 | 150 |
… | … | … | … | … | … | … | … | … | … |
Developer key
To use youtubeinfo
a Google YouTube developer key needs to be created following https://developers.google.com/youtube/registering_an_application?hl=en and can be set as environment variable.
Developer key as environment variable
Linux: edit ~/.profile and add as last line of code:
export YOUTUBE_DEVELOPER_KEY=<YOUR_YOUTUBE_DEVELOPER_KEY>
Captions
To get captions, use the argument captions=True
import youtubeinfo.core as yt
# YOUTUBE_DEVELOPER_KEY is not necessary if was set as environment variable
yt_search = yt.search("Test", caption=True)
yt_search.df # A new column with captions "video_caption" will appear
Output example:
videoId | publishedAt | channelId | title | … | commentCount | video_caption |
---|---|---|---|---|---|---|
abcde1234 | 2021-06-01 10:00:00+00:00 | abcde1234abc | Video title example 1 | … | 200 | What they say; words and more words; thanks for watching |
abcde1235 | 2021-06-01 11:00:00+00:00 | abcde1234abc | Video title example 2 | … | 210 | None |
abcde1236 | 2021-06-01 12:00:00+00:00 | abcde1234abd | Video title example 3 | … | 150 | Words and more words and more words; thanks for watching |
… | … | … | … | … | … | … |
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
youtubeinfo-0.1.4.tar.gz
(17.8 kB
view hashes)
Built Distribution
Close
Hashes for youtubeinfo-0.1.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1694c8ca0e3e59d0e60f393ea093e567ae54be0e8af5098726b8ad14478c0d2b |
|
MD5 | 63627d2ee5de53c560cfcfde18bbc872 |
|
BLAKE2b-256 | 887fb4380df40bc4f8979bd5b3ebb713d0b6c79a7e4ed1856a4873219cd4f21e |