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

Workaround: new regex pattern to find JS player signature function #17464

Closed
wants to merge 1 commit into from

Conversation

Khang-NT
Copy link
Contributor

@Khang-NT Khang-NT commented Sep 7, 2018

Before submitting a pull request make sure you have:

In order to be accepted and merged into youtube-dl each piece of code must be in public domain or released under Unlicense. Check one of the following options:

  • I am the original author of this code and I am willing to release it under Unlicense
  • I am not the original author of this code but it is in public domain or released under Unlicense (provide reliable evidence)

What is the purpose of your pull request?

  • Bug fix
  • Improvement
  • New extractor
  • New feature

Description of your pull request and other information

Fix #17457
Idea: The signature decrypt function body always start with a command like this a=a.split("");, I use this to find the entry.
https://regex101.com/r/L7kWtA/1

@phyllisstein
Copy link

FWIW I can confirm this fix works with a problem video:

Log output
~/Downloads ❯❯❯ ydl --verbose 'https://www.youtube.com/watch?v=WgQHQ-KeUaw'
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'--recode-video', u'mp4', u'--verbose', u'https://www.youtube.com/watch?v=WgQHQ-KeUaw']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2018.09.01
[debug] Python version 2.7.15 (CPython) - Darwin-18.0.0-x86_64-i386-64bit
[debug] exe versions: ffmpeg 4.0.2, ffprobe 4.0.2, rtmpdump 2.4
[debug] Proxy map: {}
[youtube] WgQHQ-KeUaw: Downloading webpage
[youtube] WgQHQ-KeUaw: Downloading video info webpage
[youtube] {43} signature length 41.42, html5 player vflvABTsY
[youtube] WgQHQ-KeUaw: Downloading player https://www.youtube.com/yts/jsbin/player-vflvABTsY/en_US/base.js
[youtube] {18} signature length 41.42, html5 player vflvABTsY
[youtube] {36} signature length 41.42, html5 player vflvABTsY
[youtube] {17} signature length 41.42, html5 player vflvABTsY
[youtube] {135} signature length 41.42, html5 player vflvABTsY
[youtube] {244} signature length 41.42, html5 player vflvABTsY
[youtube] {134} signature length 41.42, html5 player vflvABTsY
[youtube] {243} signature length 41.42, html5 player vflvABTsY
[youtube] {133} signature length 41.42, html5 player vflvABTsY
[youtube] {242} signature length 41.42, html5 player vflvABTsY
[youtube] {160} signature length 41.42, html5 player vflvABTsY
[youtube] {278} signature length 41.42, html5 player vflvABTsY
[youtube] {140} signature length 41.42, html5 player vflvABTsY
[youtube] {171} signature length 41.42, html5 player vflvABTsY
[youtube] {249} signature length 41.42, html5 player vflvABTsY
[youtube] {250} signature length 41.42, html5 player vflvABTsY
[youtube] {251} signature length 41.42, html5 player vflvABTsY
[debug] Default format spec: bestvideo+bestaudio/best
WARNING: Requested formats are incompatible for merge and will be merged into mkv.
[debug] Invoking downloader on u'https://r2---sn-ab5l6ndy.googlevideo.com/videoplayback?dur=1765.360&id=o-AIH-Ev8OcVFwB3IHIr43p9xWcrp2IP0dNUrPsBy6vRvE&initcwndbps=1242500&ei=jcWSW93pJo-N8wT2prnACQ&c=WEB&gir=yes&requiressl=yes&sparams=aitags%2Cclen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Crequiressl%2Csource%2Cexpire&ms=au%2Conr&ipbits=0&pl=32&mv=m&mt=1536345348&aitags=133%2C134%2C135%2C160%2C242%2C243%2C244%2C278&mm=31%2C26&keepalive=yes&key=yt6&ip=2604%3A2000%3A12c0%3A6de%3Af487%3A4565%3Aa374%3A53&clen=91672120&mn=sn-ab5l6ndy%2Csn-vgqskn7l&source=youtube&fvip=6&lmt=1536344003156412&expire=1536367085&itag=135&mime=video%2Fmp4&signature=39B29CC2B59C43EDE4236CF1D7E4AD9D03B1620D.C993F726A361993E2DA44F31DB95A996E23FB4D1&ratebypass=yes'
[download] Destination: Liza & David (Unaired Pilot)-WgQHQ-KeUaw.f135.mp4
[download] 100% of 87.43MiB in 00:17
[debug] Invoking downloader on u'https://r2---sn-ab5l6ndy.googlevideo.com/videoplayback?dur=1765.941&id=o-AIH-Ev8OcVFwB3IHIr43p9xWcrp2IP0dNUrPsBy6vRvE&initcwndbps=1242500&ei=jcWSW93pJo-N8wT2prnACQ&c=WEB&gir=yes&requiressl=yes&sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Crequiressl%2Csource%2Cexpire&ms=au%2Conr&ipbits=0&pl=32&mv=m&mt=1536345348&mn=sn-ab5l6ndy%2Csn-vgqskn7l&mm=31%2C26&keepalive=yes&key=yt6&ip=2604%3A2000%3A12c0%3A6de%3Af487%3A4565%3Aa374%3A53&clen=28420218&source=youtube&fvip=6&lmt=1493885804061473&expire=1536367085&itag=251&mime=audio%2Fwebm&signature=2C522DE6484E2A2AEEC193FAE11A805AF2734A32.983B55E7A9220095F4E36ADEC1EFCDDC4F229B4D&ratebypass=yes'
[download] Destination: Liza & David (Unaired Pilot)-WgQHQ-KeUaw.f251.webm
[download] 100% of 27.10MiB in 00:04

@cyberboysumanjay
Copy link

I can confirm this working. Merge it asap and release an update. Cheers!

@Bleuzen
Copy link

Bleuzen commented Sep 9, 2018

YouTube seemed to change it back. I'm still using the 2018.09.01 version (because this is the one which is currently in my distribution repository)
and since today I can download videos again. All videos so far. And youtube-dl --version outputs:
2018.09.01
The same version that didn't work yesterday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Getting error message for YouTube Videos (Signature extraction failed)
7 participants