Skip to content
This repository has been archived by the owner on Aug 23, 2024. It is now read-only.

Commit

Permalink
Fix #37 (age-restricted videos are now skipped)
Browse files Browse the repository at this point in the history
  • Loading branch information
CoffeeStraw committed May 29, 2021
1 parent f029b86 commit cd621a1
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,24 @@ def dl_from_vvvvid(url, args):

# Get m3u8 link and HTTP headers
try:
# Suppress any output if mode is not verbose
ydl_opts = (
{"verbose": True}
if args.verbose
else {"quiet": True, "no_warnings": True}
else {
"quiet": True,
"no_warnings": True,
"ignoreerrors": True,
"logger": type(
"tmp",
(object,),
{
**dict.fromkeys(
["warning", "error", "debug"], lambda x, y: None
)
},
),
}
)

with YoutubeDL(ydl_opts) as ydl:
Expand All @@ -149,11 +163,10 @@ def dl_from_vvvvid(url, args):
http_headers = "".join(
[f"{k}: {v}\n" for k, v in infos["http_headers"].items()]
)
except KeyError:
# Video could be provided by external services (like youtube). In those cases, skip the episode
except (TypeError, KeyError):
print(
f"- {Style.BRIGHT}Episodio {episode['number']}: {Style.RESET_ALL + Fore.RED}non fornito dal portale VVVVID.\n"
+ f"{Style.RESET_ALL}È possibile che il contenuto venga fornito da un servizio esterno. Il download verrà saltato."
f"- {Style.BRIGHT}Episodio {episode['number']}: {Style.RESET_ALL + Fore.RED}il contenuto non è scaricabile.\n"
+ f"{Style.RESET_ALL}È possibile che il contenuto venga fornito da un servizio esterno e/o abbia restrizioni sull'età. Il download verrà saltato."
)
continue

Expand Down

0 comments on commit cd621a1

Please sign in to comment.