Skip to content

Commit

Permalink
#26 - add referer for yt-dlp and add vidoza back to menu
Browse files Browse the repository at this point in the history
  • Loading branch information
phoenixthrush committed Dec 11, 2024
1 parent db12771 commit cbcbe22
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/aniworld/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,9 @@ def process_url(url):
self.provider_selector = self.add(
npyscreen.TitleSelectOne,
name="Provider",
values=["VOE", "Vidmoly", "Doodstream"],
max_height=3, # count of values
value=[["VOE", "Vidmoly", "Doodstream"].index(aniworld_globals.DEFAULT_PROVIDER)],
values=["VOE", "Vidmoly", "Doodstream", "Vidoza"],
max_height=4, # count of values
value=[["VOE", "Vidmoly", "Doodstream", "Vidoza"].index(aniworld_globals.DEFAULT_PROVIDER)],
scroll_exit=True
)
logging.debug("Provider selector created")
Expand Down
20 changes: 14 additions & 6 deletions src/aniworld/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def build_command(
return command


def build_yt_dlp_command(link: str, output_file: str) -> List[str]:
def build_yt_dlp_command(link: str, output_file: str, selected_provider: str) -> List[str]:
logging.debug("Building yt-dlp command with link: %s, output_file: %s", link, output_file)
command = [
"yt-dlp",
Expand All @@ -103,9 +103,16 @@ def build_yt_dlp_command(link: str, output_file: str) -> List[str]:
link,
"--progress"
]
provider = ""
if provider == "direct-link": # TODO Doodstream referrer
command.append("--http-header-fields=Referer: https://dood.li/")

doodstream_referer = "https://dood.li/"
vidmoly_referer = "https://vidmoly.to/"

if selected_provider == "Doodstream":
command.append("--add-header")
command.append(f"Referer: {doodstream_referer}")
elif selected_provider == "Vidmoly":
command.append("--add-header")
command.append(f"Referer: {vidmoly_referer}")

logging.debug("Built yt-dlp command: %s", command)
return command
Expand Down Expand Up @@ -364,7 +371,7 @@ def handle_download_action(params: Dict[str, Any]) -> None:
print(msg)
else:
print_progress_info(msg)
command = build_yt_dlp_command(params['link'], file_path)
command = build_yt_dlp_command(params['link'], file_path, params['provider'])
logging.debug("Executing command: %s", command)
try:
execute_command(command, params['only_command'])
Expand Down Expand Up @@ -525,7 +532,8 @@ def process_provider(params: Dict[str, Any]) -> None:
"season_number": season_number,
"output_directory": params['output_directory'],
"only_command": params['only_command'],
"aniskip_selected": params['aniskip_selected']
"aniskip_selected": params['aniskip_selected'],
"provider": params['provider']
}

logging.debug("Performing action with params: %s", episode_params)
Expand Down

0 comments on commit cbcbe22

Please sign in to comment.