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

RegexNotFoundError: Unable to extract Initial JS player signature function name #4175

Closed
speed-gh opened this issue Nov 13, 2014 · 17 comments
Closed

Comments

@speed-gh
Copy link

@speed-gh speed-gh commented Nov 13, 2014

(just performed 'pip install --upgrade youtube-dl' and still have this problem afterwards)

youtube-dl -F --verbose https://www.youtube.com/watch?v=HBh17_dmaFw
[debug] System config: []
[debug] User config: []
[debug] Command-line args: ['-F', '--verbose', 'https://www.youtube.com/watch?v=HBh17_dmaFw']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2014.11.12.1
[debug] Python version 2.7.8 - Linux-3.16.0-24-generic-i686-with-Ubuntu-14.10-utopic
[debug] exe versions: avconv 11-6, avprobe 11-6, rtmpdump 2.4
[debug] Proxy map: {}
[youtube] Confirming age
[youtube] HBh17_dmaFw: Downloading webpage
[youtube] HBh17_dmaFw: Downloading video info webpage
[youtube] HBh17_dmaFw: Extracting video information
[youtube] HBh17_dmaFw: Encrypted signatures detected.
[youtube] {43} signature length 45.43, html5 player en_US-vfln6g5Eq
[youtube] HBh17_dmaFw: Downloading js player vfln6g5Eq
ERROR: Signature extraction failed: Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/youtube.py", line 539, in _decrypt_signature
video_id, player_url, s
File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/youtube.py", line 453, in _extract_signature_function
res = self._parse_sig_js(code)
File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/youtube.py", line 514, in _parse_sig_js
'Initial JS player signature function name')
File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/common.py", line 436, in _search_regex
raise RegexNotFoundError('Unable to extract %s' % _name)
RegexNotFoundError: Unable to extract Initial JS player signature function name; please report this issue on https://yt-dl.org/bug . Be sure to call youtube-dl with the --verbose flag and include its complete output. Make sure you are using the latest version; type youtube-dl -U to update.
(caused by RegexNotFoundError(u'Unable to extract \x1b[0;34mInitial JS player signature function name\x1b[0m; please report this issue on https://yt-dl.org/bug . Be sure to call youtube-dl with the --verbose flag and include its complete output. Make sure you are using the latest version; type youtube-dl -U to update.',)); please report this issue on https://yt-dl.org/bug . Be sure to call youtube-dl with the --verbose flag and include its complete output. Make sure you are using the latest version; type youtube-dl -U to update.
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/youtube.py", line 539, in _decrypt_signature
video_id, player_url, s
File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/youtube.py", line 453, in _extract_signature_function
res = self._parse_sig_js(code)
File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/youtube.py", line 514, in _parse_sig_js
'Initial JS player signature function name')
File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/common.py", line 436, in _search_regex
raise RegexNotFoundError('Unable to extract %s' % _name)
RegexNotFoundError: Unable to extract Initial JS player signature function name; please report this issue on https://yt-dl.org/bug . Be sure to call youtube-dl with the --verbose flag and include its complete output. Make sure you are using the latest version; type youtube-dl -U to update.
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/youtube_dl/YoutubeDL.py", line 536, in extract_info
ie_result = ie.extract(url)
File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/common.py", line 199, in extract
return self._real_extract(url)
File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/youtube.py", line 934, in _real_extract
encrypted_sig, video_id, player_url, age_gate)
File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/youtube.py", line 549, in _decrypt_signature
'Signature extraction failed: ' + tb, cause=e)
ExtractorError: Signature extraction failed: Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/youtube.py", line 539, in _decrypt_signature
video_id, player_url, s
File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/youtube.py", line 453, in _extract_signature_function
res = self._parse_sig_js(code)
File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/youtube.py", line 514, in _parse_sig_js
'Initial JS player signature function name')
File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/common.py", line 436, in _search_regex
raise RegexNotFoundError('Unable to extract %s' % _name)
RegexNotFoundError: Unable to extract Initial JS player signature function name; please report this issue on https://yt-dl.org/bug . Be sure to call youtube-dl with the --verbose flag and include its complete output. Make sure you are using the latest version; type youtube-dl -U to update.
(caused by RegexNotFoundError(u'Unable to extract \x1b[0;34mInitial JS player signature function name\x1b[0m; please report this issue on https://yt-dl.org/bug . Be sure to call youtube-dl with the --verbose flag and include its complete output. Make sure you are using the latest version; type youtube-dl -U to update.',)); please report this issue on https://yt-dl.org/bug . Be sure to call youtube-dl with the --verbose flag and include its complete output. Make sure you are using the latest version; type youtube-dl -U to update.

@ZacharyDuBois
Copy link

@ZacharyDuBois ZacharyDuBois commented Nov 13, 2014

Same! I'd edit the issue in code tags though. Easier to read.

@martin90s
Copy link

@martin90s martin90s commented Nov 13, 2014

youtube decode rule changed?

@Checksum
Copy link

@Checksum Checksum commented Nov 13, 2014

Just came across the same issue on OS X as well.

@ZacharyDuBois
Copy link

@ZacharyDuBois ZacharyDuBois commented Nov 13, 2014

I remember something about YouTube releasing a bunch of updates today. Changing the way they encrypt stuff might have been one of them.

@awojnowski
Copy link
Contributor

@awojnowski awojnowski commented Nov 13, 2014

New decryption method looks like so:

function cv(a, b) {
    for (var c = [], d = 0; d < a.length; d++) {
        var e = a[d];
        if (e.sig || e.s) {
            var g = e.sig || fr(e.s);
            e.url = Yi(e.url, {
                signature: g
            })
        }
        e.url && c.push(bv(e.url, e.type, e.quality, e.itag, e.stereo3d))
    }
    return Vu(c, !!b)
}

The method name you have to extract is fr. I have no idea how to extract it but luckily the encryption style has not changed:

var er = {
    hG: function(a) {
        a.reverse()
    },
    xY: function(a, b) {
        a.splice(0, b)
    },
    z7: function(a, b) {
        var c = a[0];
        a[0] = a[b % a.length];
        a[b] = c
    }
};

function fr(a) {
    a = a.split("");
    er.z7(a, 1);
    er.hG(a, 63);
    er.xY(a, 3);
    er.hG(a, 30);
    er.xY(a, 2);
    er.z7(a, 10);
    er.xY(a, 3);
    er.hG(a, 30);
    return a.join("")
};

Regex should be tested against:

function Wu(a,b){for(var c=[],d=0;d<a.length;d++){var e=a[d],g;if(g=xc&&0!=e.g.video.g)g=1==e.getInfo().j;g||0!=e.g.video.g==b&&c.push(e)}return c}function cv(a,b){for(var c=[],d=0;d<a.length;d++){var e=a[d];if(e.sig||e.s){var g=e.sig||fr(e.s);e.url=Yi(e.url,{signature:g})}e.url&&c.push(bv(e.url,e.type,e.quality,e.itag,e.stereo3d))}return Vu(c,!!b)}function dv(a){a=av(a);return Vu(a,!1)}
@awojnowski
Copy link
Contributor

@awojnowski awojnowski commented Nov 13, 2014

Here's my Regex to match the function name in php:

\.sig\|\|([a-zA-Z]+)\(

Tested against:

function Wu(a,b){for(var c=[],d=0;d<a.length;d++){var e=a[d],g;if(g=xc&&0!=e.g.video.g)g=1==e.getInfo().j;g||0!=e.g.video.g==b&&c.push(e)}return c}function cv(a,b){for(var c=[],d=0;d<a.length;d++){var e=a[d];if(e.sig||e.s){var g=e.sig||fr(e.s);e.url=Yi(e.url,{signature:g})}e.url&&c.push(bv(e.url,e.type,e.quality,e.itag,e.stereo3d))}return Vu(c,!!b)}function dv(a){a=av(a);return Vu(a,!1)}

Hope that helps!

@Silvers12
Copy link

@Silvers12 Silvers12 commented Nov 13, 2014

Hello all,
I can't find youtube.py ... I go in "/usr/local/bin/youtube-dl/youtube_dl/extractor/youtube.py" but nothing here... I have a file name "/usr/local/bin/youtube-dl" but no folder "youtube-dl".

But in error msg I have : File "/usr/local/bin/youtube-dl/youtube_dl/extractor/youtube.py", line 453, in _extract_signature_function
strange no ?

@mindaslab
Copy link

@mindaslab mindaslab commented Nov 13, 2014

I got this similar error today which I post below

$ youtube-dl -f 43 https://www.youtube.com/watch?v=OHJLNrDzYm0 --verbose
[debug] System config: []
[debug] User config: []
[debug] Command-line args: ['-f', '43', 'https://www.youtube.com/watch?v=OHJLNrDzYm0', '--verbose']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2014.11.12.1
[debug] Python version 2.7.6 - Linux-3.13.0-39-generic-x86_64-with-Ubuntu-14.04-trusty
[debug] exe versions: none
[debug] Proxy map: {}
[youtube] Confirming age
[youtube] OHJLNrDzYm0: Downloading webpage
[youtube] OHJLNrDzYm0: Downloading video info webpage
[youtube] OHJLNrDzYm0: Extracting video information
[youtube] OHJLNrDzYm0: Encrypted signatures detected.
[youtube] {43} signature length 45.43, html5 player en_US-vfln6g5Eq
[youtube] OHJLNrDzYm0: Downloading js player vfln6g5Eq
ERROR: Signature extraction failed: Traceback (most recent call last):
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/youtube.py", line 539, in _decrypt_signature
    video_id, player_url, s
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/youtube.py", line 453, in _extract_signature_function
    res = self._parse_sig_js(code)
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/youtube.py", line 514, in _parse_sig_js
    'Initial JS player signature function name')
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/common.py", line 436, in _search_regex
    raise RegexNotFoundError('Unable to extract %s' % _name)
RegexNotFoundError: Unable to extract Initial JS player signature function name; please report this issue on https://yt-dl.org/bug . Be sure to call youtube-dl with the --verbose flag and include its complete output. Make sure you are using the latest version; type  youtube-dl -U  to update.
 (caused by RegexNotFoundError(u'Unable to extract \x1b[0;34mInitial JS player signature function name\x1b[0m; please report this issue on https://yt-dl.org/bug . Be sure to call youtube-dl with the --verbose flag and include its complete output. Make sure you are using the latest version; type  youtube-dl -U  to update.',)); please report this issue on https://yt-dl.org/bug . Be sure to call youtube-dl with the --verbose flag and include its complete output. Make sure you are using the latest version; type  youtube-dl -U  to update.
Traceback (most recent call last):
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/youtube.py", line 539, in _decrypt_signature
    video_id, player_url, s
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/youtube.py", line 453, in _extract_signature_function
    res = self._parse_sig_js(code)
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/youtube.py", line 514, in _parse_sig_js
    'Initial JS player signature function name')
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/common.py", line 436, in _search_regex
    raise RegexNotFoundError('Unable to extract %s' % _name)
RegexNotFoundError: Unable to extract Initial JS player signature function name; please report this issue on https://yt-dl.org/bug . Be sure to call youtube-dl with the --verbose flag and include its complete output. Make sure you are using the latest version; type  youtube-dl -U  to update.
Traceback (most recent call last):
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 536, in extract_info
    ie_result = ie.extract(url)
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/common.py", line 199, in extract
    return self._real_extract(url)
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/youtube.py", line 934, in _real_extract
    encrypted_sig, video_id, player_url, age_gate)
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/youtube.py", line 549, in _decrypt_signature
    'Signature extraction failed: ' + tb, cause=e)
ExtractorError: Signature extraction failed: Traceback (most recent call last):
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/youtube.py", line 539, in _decrypt_signature
    video_id, player_url, s
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/youtube.py", line 453, in _extract_signature_function
    res = self._parse_sig_js(code)
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/youtube.py", line 514, in _parse_sig_js
    'Initial JS player signature function name')
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/common.py", line 436, in _search_regex
    raise RegexNotFoundError('Unable to extract %s' % _name)
RegexNotFoundError: Unable to extract Initial JS player signature function name; please report this issue on https://yt-dl.org/bug . Be sure to call youtube-dl with the --verbose flag and include its complete output. Make sure you are using the latest version; type  youtube-dl -U  to update.
 (caused by RegexNotFoundError(u'Unable to extract \x1b[0;34mInitial JS player signature function name\x1b[0m; please report this issue on https://yt-dl.org/bug . Be sure to call youtube-dl with the --verbose flag and include its complete output. Make sure you are using the latest version; type  youtube-dl -U  to update.',)); please report this issue on https://yt-dl.org/bug . Be sure to call youtube-dl with the --verbose flag and include its complete output. Make sure you are using the latest version; type  youtube-dl -U  to update.
@phihag
Copy link
Contributor

@phihag phihag commented Nov 13, 2014

Thank you for the report. This has been fixed in youtube-dl 2014.11.13. See our FAQ on how to update.

@phihag phihag closed this Nov 13, 2014
@mindaslab
Copy link

@mindaslab mindaslab commented Nov 13, 2014

Okay update youtube-dl and it works now!!!!

@speed-gh
Copy link
Author

@speed-gh speed-gh commented Nov 13, 2014

Confirming 2014-11-13 works now.
Thanks for the (wow!) quick turnaround.

On Thu, Nov 13, 2014 at 3:09 AM, Karthikeyan A K notifications@github.com
wrote:

Okay update youtube-dl and it works now!!!!


Reply to this email directly or view it on GitHub
#4175 (comment).

@ZacharyDuBois
Copy link

@ZacharyDuBois ZacharyDuBois commented Nov 13, 2014

Yeah. Works here too. That was very fast. Guess YouTube should just remove their encryption. There will always be a way around it XD

@mindaslab
Copy link

@mindaslab mindaslab commented Nov 23, 2014

Should send this thread to Eric Schmidt! ;)

@akautsar
Copy link

@akautsar akautsar commented Oct 20, 2016

Hello,

I have the same error above with below information (youtube-dl version (2016.10.19)):

[pluralsight] Downloading login page
[pluralsight] Logging in as akautsar
[pluralsight] csharp-language-internals-part2-m1-0: Downloading webpage
ERROR: Unable to extract initial state; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type youtube-dl -U to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
Traceback (most recent call last):
File "C:\Users\dst\AppData\Roaming\Build archive\youtubedl\rg3\tmpv25gpk4f\build\youtube_dl\YoutubeDL.py", line 694, in extract_info
File "C:\Users\dst\AppData\Roaming\Build archive\youtubedl\rg3\tmpv25gpk4f\build\youtube_dl\extractor\common.py", line 356, in extract
File "C:\Users\dst\AppData\Roaming\Build archive\youtubedl\rg3\tmpv25gpk4f\build\youtube_dl\extractor\pluralsight.py", line 170, in_real_extract
File "C:\Users\dst\AppData\Roaming\Build archive\youtubedl\rg3\tmpv25gpk4f\build\youtube_dl\extractor\common.py", line 659, in_search_regex
youtube_dl.utils.RegexNotFoundError: Unable to extract initial state; please report this issue on https://yt-dl.org/bug.
Make sure you are using the latest version; type youtube-dl -U to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

Thanks.

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Oct 20, 2016

@akautsar That's a different bug, see #10972

@thunderrous
Copy link

@thunderrous thunderrous commented Jul 17, 2019

Getting this in 2019 but only with certain video(s). The link looks like so https://www.youtube.com/watch?v=bx-59aL-ZQw

I get this using version 2019.06.08 but not 2019.07.02. Fixed?

@remitamine
Copy link
Collaborator

@remitamine remitamine commented Jul 17, 2019

@electronicous always use the latest version.

@ytdl-org ytdl-org locked and limited conversation to collaborators Jul 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
You can’t perform that action at this time.