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

Commit

Permalink
Fixed getting http errors, caused by employing wrong media url
Browse files Browse the repository at this point in the history
  • Loading branch information
CoffeeStraw committed May 23, 2022
1 parent f6e4a3c commit feb533a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
7 changes: 4 additions & 3 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Author: CoffeeStraw
GitHub: https://github.com/CoffeeStraw/VVVVID-Downloader
"""
import re
import os
import sys
import signal
Expand Down Expand Up @@ -71,7 +72,7 @@ def dl_from_vvvvid(url, args):

# Retrieving datas about the given url
show_id = vvvvid.parse_url(url)
seasons = vvvvid.get_seasons(requests_obj, url, show_id)
seasons = vvvvid.get_seasons(requests_obj, url, show_id, args)
cont_title, cont_description = vvvvid.get_content_infos(requests_obj, show_id)

# Printing content informations to the user
Expand Down Expand Up @@ -162,8 +163,8 @@ def dl_from_vvvvid(url, args):
f"\n{Style.BRIGHT + Fore.RED}YOUTUBEDL INFOS:{Style.RESET_ALL}\n{infos}\n"
)

infos = infos["formats"][-1]
media_url = infos["url"]
infos = infos["formats"][0]
media_url = re.search(r"(https.+$)", infos["url"]).group(0)
http_headers = "".join(
[f"{k}: {v}\n" for k, v in infos["http_headers"].items()]
)
Expand Down
8 changes: 5 additions & 3 deletions src/vvvvid.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
import re
import sys
import requests
from copy import deepcopy
from colorama import Fore, Back, Style
from colorama import Fore, Style


def get_requests_obj():
Expand Down Expand Up @@ -70,7 +69,7 @@ def get_content_infos(requests_obj, show_id):
return json_file["data"]["title"], json_file["data"]["description"]


def get_seasons(requests_obj, url, show_id):
def get_seasons(requests_obj, url, show_id, args):
"""
Returns a dictionary containing seasons with url
"""
Expand All @@ -91,6 +90,9 @@ def get_seasons(requests_obj, url, show_id):
)
sys.exit(-1)

if args.verbose:
print(json_file)

# Extracting seasons from json
seasons = {}
for season in json_file["data"]:
Expand Down

0 comments on commit feb533a

Please sign in to comment.