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

extract_info throws exception for vimeo, if previously called with youtube URL #17593

Closed
mxpv opened this issue Sep 17, 2018 · 0 comments
Closed
Labels

Comments

@mxpv
Copy link

@mxpv mxpv commented Sep 17, 2018

Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2018.09.10. 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 2018.09.10

Before submitting an issue make sure you have:

  • At least skimmed through the README, most notably the FAQ and BUGS sections
  • Searched the bugtracker for similar issues including closed ones
  • Checked that provided video/audio/playlist URLs (if any) are alive and playable in a browser

What is the purpose of your issue?

  • Bug report (encountered problems with youtube-dl)

I use youtube-dl in python script and I encountered into strange issue.
I extract_info for two URLs sequentially - youtube link and than vimeo.

If vimeo extracted first, than both links are resolved correctly.
If youtube extracted first, vimeo fails with an exception. So it looks like it depends on some global state.

Here is a unit test I use:

import unittest

opts = {
    'quiet': True,
    'no_warnings': True,
    'forceurl': True,
    'simulate': True,
    'skip_download': True,
    'call_home': False,
    'nocheckcertificate': True,
    'verbose': True,
}

URL1 = 'https://youtube.com/watch?v=ygIUF678y40'
URL2 = 'https://vimeo.com/237715420'

class TestYtdl(unittest.TestCase):
    def test_youtube_dl_bad(self):
        import youtube_dl

        with youtube_dl.YoutubeDL(opts) as ytdl:
            info = ytdl.extract_info(URL1, download=False)
            self.assertIsNotNone(info)

        with youtube_dl.YoutubeDL(opts) as ytdl:
            info = ytdl.extract_info(URL2, download=False)
            self.assertIsNotNone(info)

    def test_youtube_dl_good(self):
        import youtube_dl

        with youtube_dl.YoutubeDL(opts) as ytdl:
            info = ytdl.extract_info(URL2, download=False)
            self.assertIsNotNone(info)

        with youtube_dl.YoutubeDL(opts) as ytdl:
            info = ytdl.extract_info(URL1, download=False)
            self.assertIsNotNone(info)

test_youtube_dl_good:

[debug] youtube-dl version 2018.09.10
[debug] Git HEAD: 7fd8440
[debug] Python version 3.7.0 (CPython) - Darwin-17.7.0-x86_64-i386-64bit
[debug] exe versions: none
[debug] Proxy map: {}
[debug] Default format spec: bestvideo+bestaudio/best
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2018.09.10
[debug] Git HEAD: 7fd8440
[debug] Python version 3.7.0 (CPython) - Darwin-17.7.0-x86_64-i386-64bit
[debug] exe versions: none
[debug] Proxy map: {}
[debug] Default format spec: bestvideo+bestaudio/best


Ran 1 test in 2.289s

OK

test_youtube_dl_bad:

[debug] youtube-dl version 2018.09.10
[debug] Git HEAD: 7fd8440
[debug] Python version 3.7.0 (CPython) - Darwin-17.7.0-x86_64-i386-64bit
[debug] exe versions: none
[debug] Proxy map: {}
[debug] Default format spec: bestvideo+bestaudio/best
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2018.09.10
[debug] Git HEAD: 7fd8440
[debug] Python version 3.7.0 (CPython) - Darwin-17.7.0-x86_64-i386-64bit
[debug] exe versions: none
[debug] Proxy map: {}
ERROR: Unable to extract info section (caused by ExtractorError("Unable to download webpage: HTTP Error 404: Not Found (caused by <HTTPError 404: 'Not Found'>); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.")); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
Traceback (most recent call last):
  File "venv/lib/python3.7/site-packages/youtube_dl/extractor/common.py", line 599, in _request_webpage
    return self._downloader.urlopen(url_or_request)
  File "podsync/venv/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 2211, in urlopen
    return self._opener.open(req, timeout=self._socket_timeout)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 531, in open
    response = meth(req, response)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 641, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 569, in error
    return self._call_chain(*args)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 503, in _call_chain
    result = func(*args)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 649, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "venv/lib/python3.7/site-packages/youtube_dl/extractor/vimeo.py", line 535, in _real_extract
    config_json = self._download_webpage(config_url, video_id)
  File "venv/lib/python3.7/site-packages/youtube_dl/extractor/common.py", line 761, in _download_webpage
    expected_status=expected_status)
  File "venv/lib/python3.7/site-packages/youtube_dl/extractor/common.py", line 627, in _download_webpage_handle
    urlh = self._request_webpage(url_or_request, video_id, note, errnote, fatal, data=data, headers=headers, query=query, expected_status=expected_status)
  File "venv/lib/python3.7/site-packages/youtube_dl/extractor/common.py", line 612, in _request_webpage
    raise ExtractorError(errmsg, sys.exc_info()[2], cause=err)
youtube_dl.utils.ExtractorError: Unable to download webpage: HTTP Error 404: Not Found (caused by <HTTPError 404: 'Not Found'>); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
Traceback (most recent call last):
  File "venv/lib/python3.7/site-packages/youtube_dl/extractor/common.py", line 599, in _request_webpage
    return self._downloader.urlopen(url_or_request)
  File "venv/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 2211, in urlopen
    return self._opener.open(req, timeout=self._socket_timeout)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 531, in open
    response = meth(req, response)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 641, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 569, in error
    return self._call_chain(*args)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 503, in _call_chain
    result = func(*args)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 649, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "venv/lib/python3.7/site-packages/youtube_dl/extractor/vimeo.py", line 535, in _real_extract
    config_json = self._download_webpage(config_url, video_id)
  File "venv/lib/python3.7/site-packages/youtube_dl/extractor/common.py", line 761, in _download_webpage
    expected_status=expected_status)
  File "venv/lib/python3.7/site-packages/youtube_dl/extractor/common.py", line 627, in _download_webpage_handle
    urlh = self._request_webpage(url_or_request, video_id, note, errnote, fatal, data=data, headers=headers, query=query, expected_status=expected_status)
  File "venv/lib/python3.7/site-packages/youtube_dl/extractor/common.py", line 612, in _request_webpage
    raise ExtractorError(errmsg, sys.exc_info()[2], cause=err)
youtube_dl.utils.ExtractorError: Unable to download webpage: HTTP Error 404: Not Found (caused by <HTTPError 404: 'Not Found'>); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "env/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 792, in extract_info
    ie_result = ie.extract(url)
  File "venv/lib/python3.7/site-packages/youtube_dl/extractor/common.py", line 502, in extract
    ie_result = self._real_extract(url)
  File "venv/lib/python3.7/site-packages/youtube_dl/extractor/vimeo.py", line 561, in _real_extract
    cause=e)
youtube_dl.utils.ExtractorError: Unable to extract info section (caused by ExtractorError("Unable to download webpage: HTTP Error 404: Not Found (caused by <HTTPError 404: 'Not Found'>); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.")); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.


Error
Traceback (most recent call last):
  File " venv/lib/python3.7/site-packages/youtube_dl/extractor/common.py", line 599, in _request_webpage
    return self._downloader.urlopen(url_or_request)
  File " venv/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 2211, in urlopen
    return self._opener.open(req, timeout=self._socket_timeout)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 531, in open
    response = meth(req, response)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 641, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 569, in error
    return self._call_chain(*args)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 503, in _call_chain
    result = func(*args)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 649, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File " venv/lib/python3.7/site-packages/youtube_dl/extractor/vimeo.py", line 535, in _real_extract
    config_json = self._download_webpage(config_url, video_id)
  File " venv/lib/python3.7/site-packages/youtube_dl/extractor/common.py", line 761, in _download_webpage
    expected_status=expected_status)
  File " venv/lib/python3.7/site-packages/youtube_dl/extractor/common.py", line 627, in _download_webpage_handle
    urlh = self._request_webpage(url_or_request, video_id, note, errnote, fatal, data=data, headers=headers, query=query, expected_status=expected_status)
  File " venv/lib/python3.7/site-packages/youtube_dl/extractor/common.py", line 612, in _request_webpage
    raise ExtractorError(errmsg, sys.exc_info()[2], cause=err)
youtube_dl.utils.ExtractorError: Unable to download webpage: HTTP Error 404: Not Found (caused by <HTTPError 404: 'Not Found'>); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File " venv/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 792, in extract_info
    ie_result = ie.extract(url)
  File " venv/lib/python3.7/site-packages/youtube_dl/extractor/common.py", line 502, in extract
    ie_result = self._real_extract(url)
  File " venv/lib/python3.7/site-packages/youtube_dl/extractor/vimeo.py", line 561, in _real_extract
    cause=e)
youtube_dl.utils.ExtractorError: Unable to extract info section (caused by ExtractorError("Unable to download webpage: HTTP Error 404: Not Found (caused by <HTTPError 404: 'Not Found'>); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.")); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/case.py", line 615, in run
    testMethod()
  File " cmd/ytdl/test_ytdl.py", line 46, in test_youtube_dl_bad
    info = ytdl.extract_info(URL2, download=False)
  File " venv/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 815, in extract_info
    self.report_error(compat_str(e), e.format_traceback())
  File " venv/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 620, in report_error
    self.trouble(error_message, tb)
  File " venv/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 590, in trouble
    raise DownloadError(message, exc_info)
youtube_dl.utils.DownloadError: ERROR: Unable to extract info section (caused by ExtractorError("Unable to download webpage: HTTP Error 404: Not Found (caused by <HTTPError 404: 'Not Found'>); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.")); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.



Ran 1 test in 1.590s

FAILED (errors=1)

This bug first appeared in 2018.5.1, in 2018.4.25 it works fine.

@dstftw dstftw closed this in c114851 Sep 17, 2018
@dstftw dstftw added bug fixed labels Sep 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

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