Skip to content

Commit

Permalink
fix VideoUnavailable error
Browse files Browse the repository at this point in the history
  • Loading branch information
Hetari committed Sep 25, 2024
1 parent 9958cdd commit ffccfd3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 126 deletions.
19 changes: 9 additions & 10 deletions pyutube/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
check_internet_connection,
check_for_updates
)
from pyutube.services import DownloadService, Logging
from pyutube.services import DownloadService
from pyutube.handlers import URLHandler

# Create CLI app
Expand Down Expand Up @@ -134,22 +134,21 @@ def pyutube(
sys.exit()

download_service = DownloadService(url, path, None)
logging_proxy = Logging.LoggingProxy(download_service, "DownloadService")
if audio:
logging_proxy.is_audio = True
video, video_id, _, video_audio, _ = logging_proxy.download_preparing()
logging_proxy.download_audio(video, video_audio, video_id)
download_service.is_audio = True
video, video_id, _, video_audio, _ = download_service.download_preparing()
download_service.download_audio(video, video_audio, video_id)

elif video or link_type == "short":
video, video_id, streams, video_audio, quality = logging_proxy.download_preparing()
video_file = logging_proxy.video_service.get_video_streams(quality, streams)
logging_proxy.download_video(video, video_id, video_file, video_audio)
video, video_id, streams, video_audio, quality = download_service.download_preparing()
video_file = download_service.video_service.get_video_streams(quality, streams)
download_service.download_video(video, video_id, video_file, video_audio)

elif link_type == "video":
logging_proxy.asking_video_or_audio()
download_service.asking_video_or_audio()

elif link_type == "playlist":
logging_proxy.get_playlist_links()
download_service.get_playlist_links()

else:
error_console.print("❗ Unsupported link type.")
Expand Down
114 changes: 0 additions & 114 deletions pyutube/services/Logging.py

This file was deleted.

3 changes: 3 additions & 0 deletions pyutube/services/VideoService.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ def __video_search(self) -> YouTube:
use_oauth=False,
allow_oauth_cache=True,
on_progress_callback=on_progress,

# temporary fix: VideoUnavailable error
client='WEB_CREATOR'
)

@yaspin(
Expand Down
4 changes: 2 additions & 2 deletions pyutube/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from termcolor import colored


__version__ = "1.3.22"
__version__ = "1.3.24"
__app__ = "pyutube"
ABORTED_PREFIX = "Aborted"
CANCEL_PREFIX = "Cancel"
Expand Down Expand Up @@ -214,7 +214,7 @@ def check_for_updates() -> None:
if latest_version != __version__ and latest_version < __version__:
console.print(
f"👉 A new version of {__app__} is available: {latest_version} " +
"Update it by running [bold red link=https://github.com/Hetari/pyutube]pip install --upgrade" +
"Update it by running [bold red link=https://github.com/Hetari/pyutube]pip install --upgrade " +
f"{__app__}[/bold red link]",
style="warning")
else:
Expand Down

0 comments on commit ffccfd3

Please sign in to comment.