Skip to content

Commit

Permalink
Merge pull request #27 from sutro-planet/fix-yt-download-500
Browse files Browse the repository at this point in the history
Pin a forked version of Pytube to get around video download error.
  • Loading branch information
JimmyZhangJW authored Jul 14, 2024
2 parents 8dabd74 + f9cc8cf commit 8808c9c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name: Pytvzhen-web Docker Image CI

on:
push:
branches: [ master ]
pull_request:
workflow_run:
workflows: [ "Pytvzhen-web application test" ]
branches: [ master ]
types:
- completed

jobs:
build:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/pytvzhen-web.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: 3.12.3
- name: Setup git
uses: actions4git/setup-git@v1
- name: Verify Git installation
run: git --version
- name: Lint with flake8
run: |
pip install flake8
Expand Down
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ pygtrans==1.5.3
PySocks==1.7.1
pysubs2==1.6.1
python-dateutil==2.9.0.post0
pytube==15.0.0
git+https://github.com/sutro-planet/pytube.git@pytube_fix
PyYAML==6.0.1
pyzmq==26.0.2
referencing==0.34.0
Expand Down Expand Up @@ -139,7 +139,6 @@ torchvision==0.17.2
tornado==6.4
tqdm==4.66.2
traitlets==5.14.2
triton==2.2.0
typing_extensions==4.10.0
urllib3==1.26.5
wcwidth==0.2.13
Expand Down
7 changes: 6 additions & 1 deletion test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,16 @@ def setUp(self):
self.app.testing = True

def test_download_yt_video_with_valid_video_id(self):
print("download to " + self.test_dir)
response = self.app.post("/yt_download", json={'video_id': 'VwhT-P3pLJs'})
assert response.status_code == 200
assert os.path.isfile(os.path.join(self.test_dir, 'VwhT-P3pLJs.mp4'))

def test_download_yt_video_pytube_issue(self):
# https://stackoverflow.com/questions/71883661/pytube-error-get-throttling-function-name-could-not-find-match-for-multiple
response = self.app.post("/yt_download", json={'video_id': 'SrvXsYxbgC4'})
assert response.status_code != 500, "Pytube fix not applied, see https://github.com/pytube/pytube/pull/1312"
assert response.status_code == 200

def tearDown(self):
for root, dirs, files in os.walk(self.test_dir, topdown=False):
for name in files:
Expand Down

0 comments on commit 8808c9c

Please sign in to comment.