ytdl-org / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
The Unlicense
132.75k stars 10.07k forks source link

HTTP Error 403: Forbidden when downloading video accessible in browser in private account (https://opto.sic.pt) Opto Sic download #27912

Open jgoliveira opened 3 years ago

jgoliveira commented 3 years ago

Checklist

Verbose log

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v', '-u', 'PRIVATE', '-p', 'PRIVATE', 'https://opto.sic.pt/#/play?videoId=MjoxXzAxeGV0cGhm']
[debug] Encodings: locale cp1252, fs mbcs, out cp437, pref cp1252
[debug] youtube-dl version 2021.01.16
[debug] Python version 3.4.4 (CPython) - Windows-10-10.0.19041
[debug] exe versions: ffmpeg 4.3.1-2020-11-08-full_build-www.gyan.dev, ffprobe 4.3.1-2020-11-08-full_build-www.gyan.dev
[debug] Proxy map: {}
[generic] play?videoId=MjoxXzAxeGV0cGhm: Requesting header
WARNING: Falling back on generic information extractor.
[generic] play?videoId=MjoxXzAxeGV0cGhm: Downloading webpage
[generic] play?videoId=MjoxXzAxeGV0cGhm: Extracting information
[download] Downloading playlist: Opto
[generic] playlist Opto: Collected 1 video ids (downloading 1 of them)
[download] Downloading video 1 of 1
[debug] Default format spec: bestvideo+bestaudio/best
[debug] Invoking downloader on 'https://opto.sic.pt/{{splashVideoUrl}}'
ERROR: unable to download video data: HTTP Error 403: Forbidden
Traceback (most recent call last):
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpfnvjp7pc\build\youtube_dl\YoutubeDL.py", line 1962, in process_info
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpfnvjp7pc\build\youtube_dl\YoutubeDL.py", line 1901, in dl
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpfnvjp7pc\build\youtube_dl\downloader\common.py", line 366, in download
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpfnvjp7pc\build\youtube_dl\downloader\http.py", line 351, in real_download
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpfnvjp7pc\build\youtube_dl\downloader\http.py", line 116, in establish_connection
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpfnvjp7pc\build\youtube_dl\downloader\http.py", line 110, in establish_connection
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpfnvjp7pc\build\youtube_dl\YoutubeDL.py", line 2274, in urlopen
  File "C:\Python\Python34\lib\urllib\request.py", line 470, in open
  File "C:\Python\Python34\lib\urllib\request.py", line 580, in http_response
  File "C:\Python\Python34\lib\urllib\request.py", line 508, in error
  File "C:\Python\Python34\lib\urllib\request.py", line 442, in _call_chain
  File "C:\Python\Python34\lib\urllib\request.py", line 588, in http_error_default
urllib.error.HTTPError: HTTP Error 403: Forbidden
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v', '--cookies', 'cookiefile-opto.txt', 'https://opto.sic.pt/#/play?videoId=MjoxXzAxeGV0cGhm']
[debug] Encodings: locale cp1252, fs mbcs, out cp437, pref cp1252
[debug] youtube-dl version 2021.01.16
[debug] Python version 3.4.4 (CPython) - Windows-10-10.0.19041
[debug] exe versions: ffmpeg 4.3.1-2020-11-08-full_build-www.gyan.dev, ffprobe 4.3.1-2020-11-08-full_build-www.gyan.dev
[debug] Proxy map: {}
[generic] play?videoId=MjoxXzAxeGV0cGhm: Requesting header
WARNING: Falling back on generic information extractor.
[generic] play?videoId=MjoxXzAxeGV0cGhm: Downloading webpage
[generic] play?videoId=MjoxXzAxeGV0cGhm: Extracting information
[download] Downloading playlist: Opto
[generic] playlist Opto: Collected 1 video ids (downloading 1 of them)
[download] Downloading video 1 of 1
[debug] Default format spec: bestvideo+bestaudio/best
[debug] Invoking downloader on 'https://opto.sic.pt/{{splashVideoUrl}}'
ERROR: unable to download video data: HTTP Error 403: Forbidden
Traceback (most recent call last):
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpfnvjp7pc\build\youtube_dl\YoutubeDL.py", line 1962, in process_info
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpfnvjp7pc\build\youtube_dl\YoutubeDL.py", line 1901, in dl
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpfnvjp7pc\build\youtube_dl\downloader\common.py", line 366, in download
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpfnvjp7pc\build\youtube_dl\downloader\http.py", line 351, in real_download
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpfnvjp7pc\build\youtube_dl\downloader\http.py", line 116, in establish_connection
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpfnvjp7pc\build\youtube_dl\downloader\http.py", line 110, in establish_connection
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpfnvjp7pc\build\youtube_dl\YoutubeDL.py", line 2274, in urlopen
  File "C:\Python\Python34\lib\urllib\request.py", line 470, in open
  File "C:\Python\Python34\lib\urllib\request.py", line 580, in http_response
  File "C:\Python\Python34\lib\urllib\request.py", line 508, in error
  File "C:\Python\Python34\lib\urllib\request.py", line 442, in _call_chain
  File "C:\Python\Python34\lib\urllib\request.py", line 588, in http_error_default
urllib.error.HTTPError: HTTP Error 403: Forbidden

Description

Hello there, I'm trying to download some playable videos in my browser with a service that requires a login account, so I tried in 2 ways here, and neither worked (as you can see in the 2 verbose logs):

For second command I created and used the cookies file like this:

  1. Installed the "cookies.txt" Chrome plugin: (https://chrome.google.com/webstore/detail/get-cookiestxt/bgaddhkoddajcdgocldbbfleckgcbcid?hl=en)
  2. Opened the service https://opto.sic.pt in Chrome browser and logged in
  3. Within the website select the extension (which had some cookies listed) and selected Export (this downloaded a cookies.txt for me, which I named "cookiefile-opto.txt")
  4. Started youtube-dl with the --cookies option and pass the file as a parameter (youtube-dl --cookies cookiefile-opto.txt URL)

(Btw, this kind of video is accessible by anyone just by creating a free account in the website https://opto.sic.pt/)

jgoliveira commented 3 years ago

Any help with this from anyone?

ghost commented 3 years ago

opto.sic.pt is not supported by youtube-dl and the development of youtube-dl has been stopped for months, so for now it would be practical to either

jgoliveira commented 3 years ago

Thanks for your reply @kikuyan . How to extract video url and mandatory http headers? do you know? For this case, I can't even find the video url

ghost commented 3 years ago

I can't tell any specific info. I created an account, but it looks like I have to sign up for a paid subscription plan.

jgoliveira commented 3 years ago

Hi @kikuyan . For some of the content yes, it needed a paid subscription plan, but for other content it's not, like the one I was mentioning.