Skip to content

Commit

Permalink
Fix check for invalid video ID when using config file
Browse files Browse the repository at this point in the history
Fix infinite loop if config file videos_to_scan setting contains an unavailable video ID
  • Loading branch information
ThioJoe committed Oct 26, 2022
1 parent c4b4f6a commit 50b3d1d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Scripts/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ def validate_video_id(video_url_or_id, silent=False, pass_exception=False, basic
id=possibleVideoID,
fields='items/id,items/snippet/channelId,items/snippet/channelTitle,items/statistics/commentCount,items/snippet/title',
).execute()

# Checks if video exists but is unavailable
if result['items'] == []:
print(f"\n{B.RED}{F.WHITE} ERROR: {S.R} {F.RED}No info returned for ID: {S.R} {possibleVideoID} {F.LIGHTRED_EX} - Video may be unavailable or deleted.{S.R}")
return False, None, None, None, None

if possibleVideoID == result['items'][0]['id']:
channelID = result['items'][0]['snippet']['channelId']
channelTitle = result["items"][0]["snippet"]["channelTitle"]
Expand Down
1 change: 1 addition & 0 deletions YTSpammerPurge.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,7 @@ def primaryInstance(miscData):
videoListResult[i] = validation.validate_video_id(enteredVideosList[i]) # Sends link or video ID for isolation and validation
if videoListResult[i][0] == False:
validVideoIDs = False
validConfigSetting = False
confirm = False
break

Expand Down

0 comments on commit 50b3d1d

Please sign in to comment.