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

401 Unauthorized on Discovery and Food Network #22922

Open
Demasterpl opened this issue Oct 31, 2019 · 3 comments
Open

401 Unauthorized on Discovery and Food Network #22922

Demasterpl opened this issue Oct 31, 2019 · 3 comments

Comments

@Demasterpl
Copy link

@Demasterpl Demasterpl commented Oct 31, 2019

Checklist

  • I'm reporting a broken site support issue
  • I've verified that I'm running youtube-dl version 2019.10.29
  • I've checked that all provided URLs are alive and playable in a browser
  • I've checked that all URLs and arguments with special characters are properly quoted or escaped
  • I've searched the bugtracker for similar bug reports including closed ones
  • I've read bugs section in FAQ

Verbose log

Joes-Computer:~ Joe$ youtube-dl --config-location "/Users/Joe/youtubedl/joe-youtube-dl.conf" https://watch.foodnetwork.com/tv-shows/haunted-gingerbread-showdown/full-episodes/calling-all-ghostbusters
[Discovery] calling-all-ghostbusters: Downloading content JSON metadata
ERROR: Access to the requested resource path is unauthorized; 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.
Joes-Computer:~ Joe$ youtube-dl --config-location "/Users/Joe/youtubedl/joe-youtube-dl.conf" https://watch.foodnetwork.com/tv-shows/haunted-gingerbread-showdown/full-episodes/calling-all-ghostbusters
[debug] System config: []
[debug] User config: []
[debug] Custom config: ['-o', '/Users/Joe/youtubedl/%(title)s', '-f', 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best', '--cookies', '/Users/Joe/youtubedl/cookies.txt', '--verbose']
[debug] Command-line args: ['--config-location', '/Users/Joe/youtubedl/joe-youtube-dl.conf', 'https://watch.foodnetwork.com/tv-shows/haunted-gingerbread-showdown/full-episodes/calling-all-ghostbusters']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2019.10.29
[debug] Python version 3.7.4 (CPython) - Darwin-19.0.0-x86_64-i386-64bit
[debug] exe versions: ffmpeg 4.2.1, ffprobe 4.2.1, rtmpdump 2.4
[debug] Proxy map: {}
[Discovery] calling-all-ghostbusters: Downloading content JSON metadata
ERROR: Access to the requested resource path is unauthorized; 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 "/usr/local/lib/python3.7/site-packages/youtube_dl/extractor/common.py", line 627, in _request_webpage
    return self._downloader.urlopen(/Joe/url_or_request)
  File "/usr/local/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 2237, in urlopen
    return self._opener.open(req, timeout=self._socket_timeout)
  File "/usr/local/Cellar/python/3.7.4_1/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.4_1/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.4_1/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.4_1/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.4_1/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 401: Unauthorized

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/youtube_dl/extractor/discovery.py", line 100, in _real_extract
    'show_slug': show_slug,
  File "/usr/local/lib/python3.7/site-packages/youtube_dl/extractor/common.py", line 892, in _download_json
    expected_status=expected_status)
  File "/usr/local/lib/python3.7/site-packages/youtube_dl/extractor/common.py", line 870, in _download_json_handle
    expected_status=expected_status)
  File "/usr/local/lib/python3.7/site-packages/youtube_dl/extractor/common.py", line 660, 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 "/usr/local/lib/python3.7/site-packages/youtube_dl/extractor/common.py", line 645, in _request_webpage
    raise ExtractorError(errmsg, sys.exc_info()[2], cause=err)
youtube_dl.utils.ExtractorError: Unable to download JSON metadata: HTTP Error 401: Unauthorized (caused by <HTTPError 401: 'Unauthorized'>); 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 "/usr/local/lib/python3.7/site-packages/youtube_dl/extractor/common.py", line 627, in _request_webpage
    return self._downloader.urlopen(url_or_request)
  File "/usr/local/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 2237, in urlopen
    return self._opener.open(req, timeout=self._socket_timeout)
  File "/usr/local/Cellar/python/3.7.4_1/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.4_1/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.4_1/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.4_1/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.4_1/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 401: Unauthorized

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/youtube_dl/extractor/discovery.py", line 100, in _real_extract
    'show_slug': show_slug,
  File "/usr/local/lib/python3.7/site-packages/youtube_dl/extractor/common.py", line 892, in _download_json
    expected_status=expected_status)
  File "/usr/local/lib/python3.7/site-packages/youtube_dl/extractor/common.py", line 870, in _download_json_handle
    expected_status=expected_status)
  File "/usr/local/lib/python3.7/site-packages/youtube_dl/extractor/common.py", line 660, 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 "/usr/local/lib/python3.7/site-packages/youtube_dl/extractor/common.py", line 645, in _request_webpage
    raise ExtractorError(errmsg, sys.exc_info()[2], cause=err)
youtube_dl.utils.ExtractorError: Unable to download JSON metadata: HTTP Error 401: Unauthorized (caused by <HTTPError 401: 'Unauthorized'>); 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/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 796, in extract_info
    ie_result = ie.extract(url)
  File "/usr/local/lib/python3.7/site-packages/youtube_dl/extractor/common.py", line 530, in extract
    ie_result = self._real_extract(url)
  File "/usr/local/lib/python3.7/site-packages/youtube_dl/extractor/discovery.py", line 116, in _real_extract
    raise ExtractorError(e_description)
youtube_dl.utils.ExtractorError: Access to the requested resource path is unauthorized; 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.

Description

I just setup youtube-dl within the past hour so I could download videos from the Food Network, so my setup is pretty fresh.

I run the following command:
youtube-dl --config-location "/Users/Joe/youtubedl/joe-youtube-dl.conf" https://watch.foodnetwork.com/tv-shows/haunted-gingerbread-showdown/full-episodes/calling-all-ghostbusters

and I get a 401: Unauthorized error.

I am saving the cookie file using Firefox 70.0 on my Mac OS 10.15.1 using the cookies.txt extension.

I did notice in the logs that "discovery" was mentioned and I realize that the interface is identical between the two websites. Also, I came across Issue #21810 that had the same Unauthorized error for Discovery that never went answered (#21810).

My config file has the following flags:
(pound to comment) Save all videos under Movies directory in your home directory
-o '/Users/Joe/youtubedl/%(title)s'

(pound to comment) Download best mp4 format available or any other best if no mp4 available
-f "bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best"

(pound to comment) Cookie location
--cookies "/Users/Joe/youtubedl/cookies.txt"

I selected my cable provider on Food Network's Webpage UI and I was able to start watching without entering any credentials. Assuming I already had the valid cookie, I exported them all to the file I reference in my config file. Is this an actual, old bug or is there someway I can authenticate myself?

@tv21

This comment was marked as off-topic.

@remitamine
Copy link
Collaborator

@remitamine remitamine commented Dec 5, 2019

@tv21 you're issue is different than the one reported here and it's related only to python 2.

@Demasterpl most likely the cookies you have exported are incomplete or expired.

@tv21
Copy link

@tv21 tv21 commented Dec 6, 2019

@remitamine You are correct and thank you! Forcing the use of Python 3, along with a cookies.txt file, was what was needed for my issue (but unfortunately not the issue here).

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
3 participants
You can’t perform that action at this time.