update files to change [""] to ['']
This commit is contained in:
@@ -38,8 +38,8 @@ def get_my_uploads_playlist_id(youtube):
|
||||
request = youtube.channels().list(part="contentDetails", mine=True)
|
||||
response = request.execute()
|
||||
|
||||
if "items" in response and len(response["items"]) > 0:
|
||||
return response["items"][0]["contentDetails"]["relatedPlaylists"]["uploads"]
|
||||
if "items" in response and len(response['items']) > 0:
|
||||
return response['items'][0]['contentDetails']['relatedPlaylists']['uploads']
|
||||
else:
|
||||
print("No channel found for these credentials.")
|
||||
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()
|
||||
|
||||
video_ids_batch = [
|
||||
item["snippet"]["resourceId"]["videoId"]
|
||||
item['snippet']['resourceId']['videoId']
|
||||
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()
|
||||
|
||||
for video in video_response.get("items", []):
|
||||
title = video["snippet"]["title"]
|
||||
video_id = video["id"]
|
||||
title = video['snippet']['title']
|
||||
video_id = video['id']
|
||||
# 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
|
||||
tags_lower = [tag.lower() for tag in tags]
|
||||
|
||||
@@ -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")
|
||||
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)
|
||||
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")
|
||||
DB.mark_as_downloaded(record_id)
|
||||
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":
|
||||
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")
|
||||
time.sleep(1)
|
||||
|
||||
if output["success"] is True:
|
||||
if output['success'] is True:
|
||||
print(f"Slug: {slug} | Was successfully downloaded.")
|
||||
DB.mark_as_downloaded(slug)
|
||||
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}...")
|
||||
|
||||
@@ -66,11 +66,11 @@ def download_clips():
|
||||
# Uses standard clipdownload directive
|
||||
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.")
|
||||
DB.mark_as_downloaded(slug)
|
||||
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...")
|
||||
|
||||
@@ -94,7 +94,7 @@ def upload_clips():
|
||||
|
||||
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:
|
||||
print(f"Slug: {slug} | Was successfully uploaded.")
|
||||
|
||||
@@ -36,11 +36,11 @@ def download():
|
||||
|
||||
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")
|
||||
DB.mark_as_downloaded(id)
|
||||
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...")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user