Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugins.vimeo: Fix unable to find configuration URL on some pages #5331

Merged
merged 8 commits into from May 7, 2023

Conversation

skulblakka
Copy link
Contributor

The current implementation extracts the player configuration URL from the page itself. However it looks like not all the pages contain the URL itself. This PR changes the behaviour to

  1. Get the authorization token from the viewer API. This also grabs the API base-URL (although that probably could be hard-coded)
  2. Grab the video URI from the oembed API.
  3. Use the previously grabbed API base-URL, video URI and authorization token to request the configuration URL.

Let me know if there are any issues (not sure I've used the schema validation correctly).

Tested with some random URLs and seems to work fine:

streamlink https://vimeo.com/771745400/840d05200c -l debug   
[cli][debug] OS:         Windows 10
[cli][debug] Python:     3.10.11
[cli][debug] Streamlink: 1.7.0+1115.gd2251c01
[cli][debug] Dependencies:
[cli][debug]  certifi: 2022.12.7
[cli][debug]  isodate: 0.6.1
[cli][debug]  lxml: 4.9.2
[cli][debug]  pycountry: 22.3.5
[cli][debug]  pycryptodome: 3.15.0
[cli][debug]  PySocks: 1.7.1
[cli][debug]  requests: 2.28.2
[cli][debug]  urllib3: 1.26.15
[cli][debug]  websocket-client: 1.4.1
[cli][debug] Arguments:
[cli][debug]  url=https://vimeo.com/771745400/840d05200c
[cli][debug]  --loglevel=debug
[cli][debug]  --player="H:\Tresors\Dev\mpv\build\mpv.exe"
[cli][debug]  --ringbuffer-size=1073741824
[cli][info] Found matching plugin vimeo for URL https://vimeo.com/771745400/840d05200c
[utils.l10n][debug] Language code: de_DE
[stream.ffmpegmux][debug] ffmpeg version 6.0 Copyright (c) 2000-2023 the FFmpeg developers
[stream.ffmpegmux][debug]  built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
[stream.ffmpegmux][debug]  configuration: --prefix=/mingw64 --target-os=mingw32 --arch=x86_64 --cc=gcc --cxx=g++ --disable-debug --disable-stripping --disable-doc --enable-dxva2 --enable-d3d11va --enable-fontconfig --enable-frei0r --enable-gmp --enable-gnutls --enable-gpl --enable-iconv --enable-libaom --enable-libass --enable-libbluray --enable-libcaca --enable-libdav1d --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libplacebo --enable-librsvg --enable-librtmp --enable-libssh --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libx264 --enable-libx265 --enable-libxvid --enable-libvpx --enable-libwebp --enable-libxml2 --enable-libzimg --enable-openal --enable-pic --enable-postproc --enable-runtime-cpudetect --enable-swresample --enable-version3 --enable-vulkan --enable-zlib --enable-librav1e --enable-libsvtav1 --enable-libmfx --enable-amf --enable-nvenc --logfile=config.log --enable-shared
[stream.ffmpegmux][debug]  libavutil      58.  2.100 / 58.  2.100
[stream.ffmpegmux][debug]  libavcodec     60.  3.100 / 60.  3.100
[stream.ffmpegmux][debug]  libavformat    60.  3.100 / 60.  3.100
[stream.ffmpegmux][debug]  libavdevice    60.  1.100 / 60.  1.100
[stream.ffmpegmux][debug]  libavfilter     9.  3.100 /  9.  3.100
[stream.ffmpegmux][debug]  libswscale      7.  1.100 /  7.  1.100
[stream.ffmpegmux][debug]  libswresample   4. 10.100 /  4. 10.100
[stream.ffmpegmux][debug]  libpostproc    57.  1.100 / 57.  1.100
[stream.hls][debug] Using external audio tracks for stream 540p (language=None, name=audio)
[stream.hls][debug] Using external audio tracks for stream 1080p (language=None, name=audio)
[stream.hls][debug] Using external audio tracks for stream 720p (language=None, name=audio)
[stream.hls][debug] Using external audio tracks for stream 240p (language=None, name=audio)
[stream.hls][debug] Using external audio tracks for stream 360p (language=None, name=audio)
[utils.l10n][debug] Language code: de_DE
[stream.hls][debug] Using external audio tracks for stream 540p (language=None, name=audio)
[stream.hls][debug] Using external audio tracks for stream 1080p (language=None, name=audio)
[stream.hls][debug] Using external audio tracks for stream 720p (language=None, name=audio)
[stream.hls][debug] Using external audio tracks for stream 240p (language=None, name=audio)
[stream.hls][debug] Using external audio tracks for stream 360p (language=None, name=audio)
[utils.l10n][debug] Language code: de_DE
[stream.dash][debug] Available languages for DASH audio streams: NONE (using: n/a)
[utils.l10n][debug] Language code: de_DE
[stream.dash][debug] Available languages for DASH audio streams: NONE (using: n/a)
Available streams: 240p_alt (worst), 240p, 240p+a67k_alt, 240p+a67k, 240p+a99k_alt, 240p+a99k, 240p+a191k_alt, 240p+a191k, 360p_alt, 360p, 360p+a67k_alt, 360p+a67k, 360p+a99k_alt, 360p+a99k, 360p+a191k_alt, 360p+a191k, 540p_alt, 540p, 540p+a67k_alt, 540p+a67k, 540p+a99k_alt, 540p+a99k, 
540p+a191k_alt, 540p+a191k, 720p_alt, 720p, 720p+a67k_alt, 720p+a67k, 720p+a99k_alt, 720p+a99k, 720p+a191k_alt, 720p+a191k, 1080p_alt, 1080p, 1080p+a67k_alt, 1080p+a67k, 1080p+a99k_alt, 1080p+a99k, 1080p+a191k_alt, 1080p+a191k (best)

Resolves #5015.

@mkbloke mkbloke added plugin issue A Plugin does not work correctly PR: squash commits Commits need to be squashed as a single commit - eg. multiple commits for a single component labels May 6, 2023
Copy link
Member

@bastimeyer bastimeyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Just a quick review of the diff for now. I'll have a look at the whole changes later.

not all the pages contain the URL itself

Those who do however don't have to make additional API queries, so a bit of initialization time when finding streams could be avoided.

src/streamlink/plugins/vimeo.py Outdated Show resolved Hide resolved
src/streamlink/plugins/vimeo.py Outdated Show resolved Hide resolved
src/streamlink/plugins/vimeo.py Outdated Show resolved Hide resolved
@skulblakka
Copy link
Contributor Author

Thanks for the feedback. Refactored my changes a bit. Let me know if I understood everything correctly.

Copy link
Member

@bastimeyer bastimeyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

./script/test-plugin-urls.py vimeo -> OK
ignoring the dead video URLs (might be worth replacing them)

src/streamlink/plugins/vimeo.py Outdated Show resolved Hide resolved
@bastimeyer bastimeyer merged commit c3258aa into streamlink:master May 7, 2023
23 checks passed
@bastimeyer
Copy link
Member

Thanks, @skulblakka

@skulblakka skulblakka deleted the fix/vimeo branch May 7, 2023 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin issue A Plugin does not work correctly PR: squash commits Commits need to be squashed as a single commit - eg. multiple commits for a single component
Projects
None yet
Development

Successfully merging this pull request may close these issues.

plugins.vimeo: No playable streams found on this URL: https://vimeo.com/<segment1>/<segment2>
3 participants