Skip to content

Commit

Permalink
Use different downloader for youtube
Browse files Browse the repository at this point in the history
  • Loading branch information
pseudotensor committed Oct 26, 2024
1 parent f28e728 commit e1440e4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
8 changes: 4 additions & 4 deletions docs/run_patches.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ sed -i 's/with HiddenPrints():/if True:/g' $sp/langchain_community/utilities/se
# find "$sp" -type f -name "*.py" -exec sed -i -E 's/(sys\.stdout\s*=\s*.*)/pass # \1/; s/(sys\.stderr\s*=\s*.*)/pass # \1/' {} +

# use pytubefix instead, pytube too old and various issues
sed -i 's/Pytube/PytubeFix/g' $sp/fiftyone/utils/youtube.py
sed -i 's/pytube>=15/pytube>=6/g' $sp/fiftyone/utils/youtube.py
sed -i 's/pytube/pytubefix/g' $sp/fiftyone/utils/youtube.py
#sed -i 's/Pytube/PytubeFix/g' $sp/fiftyone/utils/youtube.py
#sed -i 's/pytube>=15/pytube>=6/g' $sp/fiftyone/utils/youtube.py
#sed -i 's/pytube/pytubefix/g' $sp/fiftyone/utils/youtube.py

# diff -Naru /home/jon/miniconda3/envs/h2ogpt/lib/python3.10/site-packages/pytubefix/extract.py ~/extract.py > docs/pytubefix.patch
patch $sp/pytubefix/extract.py docs/pytubefix.patch
#patch $sp/pytubefix/extract.py docs/pytubefix.patch

# fix asyncio same way websockets was fixed, else keep hitting errors in async calls
# https://github.com/python-websockets/websockets/commit/f9fd2cebcd42633ed917cd64e805bea17879c2d7
Expand Down
2 changes: 1 addition & 1 deletion reqs_optional/requirements_optional_image.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ yt-dlp>=2024.8.6
# moviepy>=0.5.1

# for fiftyone with patches
pytubefix==6.15.4
pytubefix==8.1.1
2 changes: 1 addition & 1 deletion src/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "028f433b69021436a7ffd5f26970eb7ec0bfbfa7"
__version__ = "f28e728d5e5a3f67c2642641e2743d2c7fbe7aea"
10 changes: 8 additions & 2 deletions src/vision/extract_movie.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import sys
import uuid

from src.utils import makedirs, sanitize_filename, get_gradio_tmp
Expand All @@ -14,8 +15,13 @@ def extract_unique_frames(urls=None, file=None, download_dir=None, export_dir=No
makedirs(download_dir, exist_ok=True)
# os.environ['FIFTYONE_DISABLE_SERVICES'] = 'True'
if urls:
import fiftyone.utils.youtube as fouy
fouy.download_youtube_videos(urls, download_dir=download_dir)
if 'openai_server' not in sys.path:
sys.path.append('openai_server')
from openai_server.agent_tools.download_web_video import download_web_video
for url in urls:
download_web_video(video_url=url, base_url="https://www.youtube.com", output_dir=download_dir)
#import fiftyone.utils.youtube as fouy
#fouy.download_youtube_videos(urls, download_dir=download_dir)

# Create a FiftyOne Dataset
import fiftyone as fo
Expand Down

0 comments on commit e1440e4

Please sign in to comment.