update files to change [""] to ['']

This commit is contained in:
2026-07-24 12:22:35 +00:00
parent 0f96eedc54
commit 6882b7ae04
4 changed files with 15 additions and 15 deletions
+6 -6
View File
@@ -38,8 +38,8 @@ def get_my_uploads_playlist_id(youtube):
request = youtube.channels().list(part="contentDetails", mine=True) request = youtube.channels().list(part="contentDetails", mine=True)
response = request.execute() response = request.execute()
if "items" in response and len(response["items"]) > 0: if "items" in response and len(response['items']) > 0:
return response["items"][0]["contentDetails"]["relatedPlaylists"]["uploads"] return response['items'][0]['contentDetails']['relatedPlaylists']['uploads']
else: else:
print("No channel found for these credentials.") print("No channel found for these credentials.")
return None return None
@@ -70,7 +70,7 @@ def scan_channel_videos_for_tag(youtube, uploads_playlist_id: str, target_tag: s
playlist_response = playlist_request.execute() playlist_response = playlist_request.execute()
video_ids_batch = [ video_ids_batch = [
item["snippet"]["resourceId"]["videoId"] item['snippet']['resourceId']['videoId']
for item in playlist_response.get("items", []) for item in playlist_response.get("items", [])
] ]
@@ -87,10 +87,10 @@ def scan_channel_videos_for_tag(youtube, uploads_playlist_id: str, target_tag: s
video_response = video_request.execute() video_response = video_request.execute()
for video in video_response.get("items", []): for video in video_response.get("items", []):
title = video["snippet"]["title"] title = video['snippet']['title']
video_id = video["id"] video_id = video['id']
# Tags are optional fields on YouTube; default to an empty list if absent # Tags are optional fields on YouTube; default to an empty list if absent
tags = video["snippet"].get("tags", []) tags = video['snippet'].get("tags", [])
# Normalize tags to lowercase for clean matching evaluation # Normalize tags to lowercase for clean matching evaluation
tags_lower = [tag.lower() for tag in tags] tags_lower = [tag.lower() for tag in tags]
+4 -4
View File
@@ -58,11 +58,11 @@ def download():
output = linux.run_command(f"TwitchDownloaderCLI videodownload --id {record_id} -o save/videos/{record_id}/{record_id}.mp4 --collision Overwrite") output = linux.run_command(f"TwitchDownloaderCLI videodownload --id {record_id} -o save/videos/{record_id}/{record_id}.mp4 --collision Overwrite")
output2 = linux.run_command(f"TwitchDownloaderCLI chatdownload --id {record_id} -o save/videos/{record_id}/{record_id}_chat.json -E --collision Overwrite") output2 = linux.run_command(f"TwitchDownloaderCLI chatdownload --id {record_id} -o save/videos/{record_id}/{record_id}_chat.json -E --collision Overwrite")
time.sleep(1) time.sleep(1)
if output["success"] is True: if output['success'] is True:
print(f"ID: {record_id} | Date: {record_date} | Game: {game_name} | Title: {title} | was successful") print(f"ID: {record_id} | Date: {record_date} | Game: {game_name} | Title: {title} | was successful")
DB.mark_as_downloaded(record_id) DB.mark_as_downloaded(record_id)
else: else:
print(f"ID: {record_id} | Download Process failed. {output["stdout"]}. Error: {output["stderr"]}") print(f"ID: {record_id} | Download Process failed. {output['stdout']}. Error: {output['stderr']}")
elif DB.table == "clips": elif DB.table == "clips":
for slug, record_date, title, game_name, clip_by, views, downloaded, uploaded_yt, uploaded_shorts_yt in undownloaded: for slug, record_date, title, game_name, clip_by, views, downloaded, uploaded_yt, uploaded_shorts_yt in undownloaded:
@@ -72,11 +72,11 @@ def download():
output = linux.run_command(f"TwitchDownloaderCLI clipdownload --id {slug} -o save/clips/{slug}/{slug}.mp4 --collision Overwrite") output = linux.run_command(f"TwitchDownloaderCLI clipdownload --id {slug} -o save/clips/{slug}/{slug}.mp4 --collision Overwrite")
time.sleep(1) time.sleep(1)
if output["success"] is True: if output['success'] is True:
print(f"Slug: {slug} | Was successfully downloaded.") print(f"Slug: {slug} | Was successfully downloaded.")
DB.mark_as_downloaded(slug) DB.mark_as_downloaded(slug)
else: else:
print(f"Slug: {slug} | Download Process failed. {output["stdout"]}. Error: {output["stderr"]}") print(f"Slug: {slug} | Download Process failed. {output['stdout']}. Error: {output['stderr']}")
print(f"Finished Downloading {DB.table}...") print(f"Finished Downloading {DB.table}...")
+3 -3
View File
@@ -66,11 +66,11 @@ def download_clips():
# Uses standard clipdownload directive # Uses standard clipdownload directive
output = run_linux_command(f"TwitchDownloaderCLI clipdownload --id {slug} -o save/clips/{slug}/{slug}.mp4") output = run_linux_command(f"TwitchDownloaderCLI clipdownload --id {slug} -o save/clips/{slug}/{slug}.mp4")
if output["success"] is True: if output['success'] is True:
print(f"Slug: {slug} | Was successfully downloaded.") print(f"Slug: {slug} | Was successfully downloaded.")
DB.mark_as_downloaded(slug) DB.mark_as_downloaded(slug)
else: else:
print(f"Slug: {slug} | Download Process failed. {output["stdout"]}. Error: {output["stderr"]}") print(f"Slug: {slug} | Download Process failed. {output['stdout']}. Error: {output['stderr']}")
print("Finished Downloading Clips...") print("Finished Downloading Clips...")
@@ -94,7 +94,7 @@ def upload_clips():
tags.extend(top_hashtags({slug})) tags.extend(top_hashtags({slug}))
#output = uploader.upload_video(file_path, title, categoryId, description, privatcyStatus, tags) output = uploader.upload_video(file_path, title, categoryId, description, privatcyStatus, tags)
if output is True: if output is True:
print(f"Slug: {slug} | Was successfully uploaded.") print(f"Slug: {slug} | Was successfully uploaded.")
+2 -2
View File
@@ -36,11 +36,11 @@ def download():
time.sleep(1) time.sleep(1)
if output["success"] is True: if output['success'] is True:
print(f"ID: {id} | Date: {created_at} | Game: {game_name} | Title: {title} | was successful") print(f"ID: {id} | Date: {created_at} | Game: {game_name} | Title: {title} | was successful")
DB.mark_as_downloaded(id) DB.mark_as_downloaded(id)
else: else:
print(f"ID: {id} | Download Process failed. {output["stdout"]}. Error: {output["stderr"]}") print(f"ID: {id} | Download Process failed. {output['stdout']}. Error: {output['stderr']}")
print(f"Finished Downloading...") print(f"Finished Downloading...")