youtube-dl: [pornhub.com] ValueError: unknown url type: /*c783868bc0e01f259bca*/c783868bc0e01f259bca/*fdcbae*/...

Please follow the guide below

  • You will be asked some questions and requested to provide some information, please read them carefully and answer honestly
  • Put an x into all the boxes [ ] relevant to your issue (like that [x])
  • Use Preview tab to see how your issue will actually look like

Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2017.02.14. If it’s not read this FAQ entry and update. Issues with outdated version will be rejected.

  • I’ve verified and I assure that I’m running youtube-dl 2017.02.14

Before submitting an issue make sure you have:

  • At least skimmed through README and most notably FAQ and BUGS sections
  • Searched the bugtracker for similar issues including closed ones

What is the purpose of your issue?

  • Bug report (encountered problems with youtube-dl)
  • Site support request (request for adding support for a new site)
  • Feature request (request for a new functionality)
  • Question
  • Other

[issue] http://www.pornhub.com/view_video.php?viewkey=ph588edef3b9f03 Can’t be downloaded, error message is: ValueError: unknown url type: /c783868bc0e01f259bca/c783868bc0e01f259bca/fdcbae/d5d92256fcc46f27d/edf2a757f7d5215004/fdcbae/a533b33fb773c0cee02/e19d715e98acc2f05022739abbe/a2f07b472cc9ea5506c14e6b/a2f07b472cc9ea5506c14e6b/d9efb8fed99c/d9efb8fed99c/b5160c30aac2a/c76952c6c6e3a5ec743d8ae3d4d2d/e19d715e98acc2f05022739abbe/fa1551ae8084a6b68a11f/e45adc12/bd62/be2f6ebe2a35af6378/e45adc12/b5160c30aac2a/be2f6ebe2a35af6378/cc51db0f9206969b8af8f6/da8bd/a533b33fb773c0cee02/a533b33fb773c0cee02/ed724b928c777b6b/ade/d9efb8fed99c/b5160c30aac2a/ade/c73100/be2f6ebe2a35af6378/ed724b928c777b6b/c76952c6c6e3a5ec743d8ae3d4d2d/ce0229a65a8cf91ff7731720/bd62/edf2a757f7d5215004/bd62/cd1742706bd8e18279b42/fdcbae/cc51db0f9206969b8af8f6 Reason: website code changed.

[Rolution] Revised file: youtube_dl\extractor\pornhub.py Replace old code with:

        # from line 159, version: 2017.02.14
        # video_variables = {}
        # for video_variablename, quote, video_variable in re.findall(
        #         r'(player_quality_[0-9]{3,4}p\w+)\s*=\s*(["\'])(.+?)\2;', webpage):
        #     video_variables[video_variablename] = video_variable
        #
        # video_urls = []
        # for encoded_video_url in re.findall(
        #         r'player_quality_[0-9]{3,4}p\s*=(.+?);', webpage):
        #     for varname, varval in video_variables.items():
        #         encoded_video_url = encoded_video_url.replace(varname, varval)
        #     video_urls.append(re.sub(r'[\s+]', '', encoded_video_url))
        pattern = r'var\s*player_mp4_seek\s*=\s*.*((\s|.)*?)flashvars';
        new_webpage = re.findall(pattern, webpage)[0][0]
        video_variables = {}
        for video_variablename, quote, video_variable in re.findall(
                r'(\w+?)=(["\'])(.+?)\2;', new_webpage):
            video_variables[video_variablename] = video_variable.replace('" + "', '')

        video_urls = []
        for encoded_video_url in re.findall(
                r'player_quality_[0-9]{3,4}p\s*=(.+?);', new_webpage):
            pattern = r'\/\*(\s|.)*?\*\/'
            encoded_video_url = re.sub(pattern, '', encoded_video_url).strip()
            for varname, varval in video_variables.items():
                encoded_video_url = encoded_video_url.replace(varname, varval)
                encoded_video_url = encoded_video_url.replace(' + ', '')
            video_urls.append(re.sub(r'[\s+]', '', encoded_video_url))

Problem solving.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 18 (8 by maintainers)

Commits related to this issue

Most upvoted comments

yep confirmed! they just reverted back to same old technique ! use this

player_quality_[0-9]{3,4}p\s*=\s*(["\'])(.+?)\1;

You’re free to use js2py in your forks, but I won’t accept patches with js2py as it uses exec() [1], which is a big security hole.

[1] https://github.com/PiotrDabkowski/Js2Py/blob/627a6b9/js2py/evaljs.py#L175

Today, 2017-02-15, pornhub.com changed again… it seems to be changed back! We get the correct video_url, but download error: ERROR: unable to download video data: <urlopen error unknown url type: "http>

Reason: double quotes in video_urls, caused protocol parse error. Resolved: replace it with empty string. encoded_video_url = encoded_video_url.replace(‘"’, ‘’)