updated README, made yt-dlp downloading more robust against errors, changed name of videos folder to media (since images and audio files are also downloaded now)

This commit is contained in:
Tristan Lee
2023-09-04 13:51:28 -05:00
parent 5ae9624968
commit 8c32a3cf16
2 changed files with 18 additions and 17 deletions

View File

@@ -155,7 +155,7 @@ class TikTokDownloader:
# Define file containing post data and directory to save videos to
hashtag_file = self.data_dir / hashtag / "posts.json"
video_dir = self.data_dir / hashtag / "videos"
video_dir = self.data_dir / hashtag / "media"
video_dir.mkdir(exist_ok=True)
# Get list of post IDs that have previously had their media downloaded
@@ -191,8 +191,8 @@ class TikTokDownloader:
# Download video files for all video posts
if len(urls_to_download) > 0:
logging.info(f"Downloading videos for hashtag {hashtag}")
ydl_opts = {"outtmpl": os.path.join(video_dir, "%(id)s.%(ext)s")}
logging.info(f"Downloading media for hashtag {hashtag}")
ydl_opts = {"outtmpl": os.path.join(video_dir, "%(id)s.%(ext)s"), "ignore_errors": True}
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
ydl.download(urls_to_download)