youtube_get_newest_video_fr.../README.md

43 lines
1.5 KiB
Markdown
Raw Permalink Normal View History

2021-09-13 22:09:14 +02:00
# youtube_get_newest_video_from_channel
2020-11-22 16:19:59 +01:00
Small Python script to get the latest video from a specific Youtube channel and returns it's title and url
2017-10-07 18:46:39 +02:00
2021-09-13 22:09:14 +02:00
[![Build Status](https://drone.pyas.de/api/badges/Kim/youtube_get_newest_video_from_channel/status.svg)](https://drone.pyas.de/Kim/youtube_get_newest_video_from_channel)
2020-11-22 16:19:59 +01:00
* You need to get an API Key for the [Youtube Data API V3](https://console.developers.google.com/) -> Create a project, then add a key to it
* The Channel ID -> May be Part of the URL if you go to the channel (after 'https://www.youtube.com/channel/' and before the first '?&'
2017-10-07 18:46:39 +02:00
2020-11-22 16:19:59 +01:00
**Hint:**
2021-09-13 22:09:14 +02:00
Nowadays the channel url doesn't always show the channel id, but sometimes the channel name.
2020-11-22 16:19:59 +01:00
However the script needs the channel id. You can get the id from here when you only have the channel name: https://commentpicker.com/youtube-channel-id.php
2021-09-13 22:09:14 +02:00
A channel id looks like this `UCmpilcSVu1T-AsAiiHbfpcA`
2020-11-22 16:19:59 +01:00
2021-09-13 22:09:14 +02:00
Requires python module '_requests_' to work.
2020-12-02 11:29:29 +01:00
## Usage example
````python
from GetLatestVideo import API
# Add your Youtube Data API V3 Key here
API_KEY = ''
2021-09-13 22:09:14 +02:00
# Add the Channel ID(s) here,
2020-12-02 11:29:29 +01:00
# When you only know the channel name you can get the ID from here https://commentpicker.com/youtube-channel-id.php
CHANNEL_ID = [
'ID1',
'ID2'
]
videos = []
yt = API(API_KEY)
for channel in CHANNEL_ID:
videos.append(yt.get_latest_video(channel))
print(videos)
2021-09-13 22:09:14 +02:00
````
2021-09-21 22:00:11 +02:00
## Credits
Repo Icon made by [Freepik](https://www.freepik.com "Freepik") from [www.flaticon.com](https://www.flaticon.com/ "Flaticon")