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

plugin.youtube: bug fix for get video ID from currentVideoEndpoint #2538

Closed
wants to merge 3 commits into from

Conversation

Projects
None yet
4 participants
@jitingcn
Copy link
Contributor

commented Jul 11, 2019

No description provided.

@codecov

This comment has been minimized.

Copy link

commented Jul 11, 2019

Codecov Report

Merging #2538 into master will not change coverage.
The diff coverage is 50%.

@@           Coverage Diff           @@
##           master    #2538   +/-   ##
=======================================
  Coverage   52.54%   52.54%           
=======================================
  Files         239      239           
  Lines       15129    15129           
=======================================
  Hits         7949     7949           
  Misses       7180     7180
@codecov

This comment has been minimized.

Copy link

commented Jul 11, 2019

Codecov Report

Merging #2538 into master will increase coverage by <.01%.
The diff coverage is 66.66%.

@@            Coverage Diff             @@
##           master    #2538      +/-   ##
==========================================
+ Coverage   52.54%   52.54%   +<.01%     
==========================================
  Files         239      239              
  Lines       15129    15130       +1     
==========================================
+ Hits         7949     7950       +1     
  Misses       7180     7180
@bastimeyer
Copy link
Member

left a comment

Thanks for the PR.
Do you have an example YT video for this?

Show resolved Hide resolved src/streamlink/plugins/youtube.py Outdated
Show resolved Hide resolved src/streamlink/plugins/youtube.py Outdated
@jitingcn

This comment has been minimized.

Copy link
Contributor Author

commented Jul 11, 2019

It should work for all YT live stream video like: https://www.youtube.com/user/Wimbledon/live

@ErAzOr2k

This comment has been minimized.

Copy link

commented Jul 11, 2019

doesn't work for youtube.com/rocketbeanstv/live

@jitingcn

This comment has been minimized.

Copy link
Contributor Author

commented Jul 11, 2019

doesn't work for youtube.com/rocketbeanstv/live

That maybe another issue, seem can't get correctly hls url in best quality when 1080p and 1080p60 exist at the same time.

Try to download best quality (1080p60) with format code 299

$ streamlink -o test.ts https://www.youtube.com/rocketbeanstv/live best -l debug
[cli][debug] OS:         Linux-5.1.15-arch1-1-ARCH-x86_64-with-arch
[cli][debug] Python:     3.7.3
[cli][debug] Streamlink: 1.1.1+39.g04f0b0d
[cli][debug] Requests(2.22.0), Socks(1.6.7), Websocket(0.56.0)
[cli][info] Found matching plugin youtube for URL https://www.youtube.com/rocketbeanstv/live
[plugin.youtube][debug] Video ID from currentVideoEndpoint
[plugin.youtube][debug] Using video ID: E-MsayZ_Epw
[plugin.youtube][debug] get_video_info - 1: Found data
[plugin.youtube][debug] MuxedStream: v 137 a 140 = 1080p
[plugin.youtube][debug] MuxedStream: v 299 a 140 = 1080p60
[utils.l10n][debug] Language code: zh_CN
[cli][info] Available streams: audio_mp4, 144p (worst), 240p, 360p, 480p, 720p, 1080p, 1080p60 (best)
[cli][info] Opening stream: 1080p60 (muxed-stream)
[stream.ffmpegmux][debug] Opening http substream
[stream.ffmpegmux][debug] Opening http substream
[stream.mp4mux-ffmpeg][debug] ffmpeg command: ffmpeg -nostats -y -i /tmp/ffmpeg-74555-150 -i /tmp/ffmpeg-74555-765 -c:v copy -c:a copy -map 0 -map 1 -f matroska pipe:1
[stream.ffmpegmux][debug] Starting copy to pipe: /tmp/ffmpeg-74555-150
[stream.ffmpegmux][debug] Starting copy to pipe: /tmp/ffmpeg-74555-765
[cli][debug] Pre-buffering 8192 bytes
[stream.ffmpegmux][debug] Pipe copy complete: /tmp/ffmpeg-74555-765
[cli][debug] Checking file output
[cli][debug] Writing stream to output
[stream.ffmpegmux][debug] Pipe copy complete: /tmp/ffmpeg-74555-150

[stream.ffmpegmux][debug] Closing ffmpeg thread
[stream.ffmpegmux][debug] Closed all the substreams
[cli][info] Stream ended
[cli][info] Closing currently open stream...
[stream.ffmpegmux][debug] Closing ffmpeg thread
[stream.ffmpegmux][debug] Closed all the substreams
[stream.ffmpegmux][debug] Closing ffmpeg thread
[stream.ffmpegmux][debug] Closed all the substreams

It will try to get the http substream and exit directly, only one frame/segment of data can be obtained.

If you choose 1080p quality, it can download as normal.

$ streamlink -o test.ts https://www.youtube.com/rocketbeanstv/live 1080p -l debug
[cli][debug] OS:         Linux-5.1.15-arch1-1-ARCH-x86_64-with-arch
[cli][debug] Python:     3.7.3
[cli][debug] Streamlink: 1.1.1+39.g04f0b0d
[cli][debug] Requests(2.22.0), Socks(1.6.7), Websocket(0.56.0)
[cli][info] Found matching plugin youtube for URL https://www.youtube.com/rocketbeanstv/live
[plugin.youtube][debug] Video ID from currentVideoEndpoint
[plugin.youtube][debug] Using video ID: E-MsayZ_Epw
[plugin.youtube][debug] get_video_info - 1: Found data
[plugin.youtube][debug] MuxedStream: v 137 a 140 = 1080p
[plugin.youtube][debug] MuxedStream: v 299 a 140 = 1080p60
[utils.l10n][debug] Language code: zh_CN
[cli][info] Available streams: audio_mp4, 144p (worst), 240p, 360p, 480p, 720p, 1080p, 1080p60 (best)
[cli][info] Opening stream: 1080p (hls)
[stream.hls][debug] Reloading playlist
[stream.hls][debug] First Sequence: 72157; Last Sequence: 75755
[stream.hls][debug] Start offset: 0; Duration: None; Start Sequence: 75753; End Sequence: None
[stream.hls][debug] Adding segment 75753 to queue
[cli][debug] Pre-buffering 8192 bytes
[stream.hls][debug] Adding segment 75754 to queue
[stream.hls][debug] Adding segment 75755 to queue

Update src/streamlink/plugins/youtube.py
Co-Authored-By: back-to <backto@protonmail.ch>
@jitingcn

This comment has been minimized.

Copy link
Contributor Author

commented Jul 12, 2019

Now YouTube change back the pattern of content 'window["ytInitialData"]', I will close this pr.

@jitingcn jitingcn closed this Jul 12, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.