-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAutoDownload.py
More file actions
23 lines (19 loc) · 843 Bytes
/
AutoDownload.py
File metadata and controls
23 lines (19 loc) · 843 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import yt_dlp as youtube_dl
from feedparser import parse
def download_videos(subs_feed_url, output_folder):
feed = parse(subs_feed_url)
for entry in feed.entries[:5]: # for last 5 videos
video_url = entry.link
try:
ydl_opts = {
'outtmpl': f'{output_folder}/%(title)s.%(ext)s',
'format': 'best'
}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
ydl.download([video_url])
print(f"Downloaded: {video_url}")
except Exception as e:
print(f"Failed to download: {video_url}, Reason: {e}")
subs_feed_url = "https://www.youtube.com/feeds/videos.xml?channel_id=Your-own-channel-id"
output_folder = "folder-name where videos will be downloaded"
download_videos(subs_feed_url, output_folder)