diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c9e4e0c..7985101 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -107,7 +107,7 @@ jobs: sed -i 's/ != video_id/ != video_id or video_id in ("bWgPKTOMoSY", "9UMxZofMNbA")/g' src/YouTubeVideoUrl.py - name: Test code with pytest run: | - pytest -rx -v --cov=src --cov-report=xml --cov-report=html + YOUTUBE_PLUGIN_TOKEN=${{ secrets.YOUTUBE_PLUGIN_TOKEN }} pytest -rx -v --cov=src --cov-report=xml --cov-report=html mv .coverage .coverage_${{ matrix.python-version }} - name: Upload code coverage results uses: actions/upload-artifact@v4 @@ -160,7 +160,7 @@ jobs: - name: Install additional dependencies if: matrix.enigma2-version == 'openatv master 3.12' || matrix.enigma2-version == 'OpenViX Developer 3.12' run: | - pip install requests chardet + pip install requests chardet six - name: Link plugin files for test working-directory: './enigma2/lib/python/Plugins/Extensions' run: | diff --git a/src/YouTubeVideoUrl.py b/src/YouTubeVideoUrl.py index 8550674..1d9199b 100644 --- a/src/YouTubeVideoUrl.py +++ b/src/YouTubeVideoUrl.py @@ -473,7 +473,7 @@ def _real_extract(self, video_id, yt_auth): url = fmt.get('url') if url: break - if not url: # pragma: no cover + if not url and streaming_formats: # pragma: no cover url = streaming_formats[0].get('url', '') if not url: diff --git a/test/test_plugin.py b/test/test_plugin.py index 8f1d84b..c1575f3 100755 --- a/test/test_plugin.py +++ b/test/test_plugin.py @@ -59,8 +59,10 @@ def get_video_id(q, event_type, order, s_type): def get_url(videos): from src.YouTubeVideoUrl import YouTubeVideoUrl + from src.YouTubeApi import YouTubeApi ytdl = YouTubeVideoUrl() - video_url = ytdl.extract(videos) + ytapi = YouTubeApi(os.environ['YOUTUBE_PLUGIN_TOKEN']) + video_url = ytdl.extract(videos, ytapi.get_yt_auth()) video_url = video_url.split('&suburi=', 1)[0] print('Video Url', video_url) return video_url