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.23k stars 10.03k forks source link

Facebook prompting verification when downloading videos #29019

Closed harieamjari closed 3 years ago

harieamjari commented 3 years ago

Checklist

Verbose log

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['https://www.facebook.com/groups/2180265525569106/permalink/2838450249750627', '--verbose', '-u', 'PRIVATE', '-p', 'PRIVATE']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2021.04.26
[debug] Python version 3.8.0 (CPython) - Linux-3.18.19-15382149-armv7l-with-libc
[debug] exe versions: ffmpeg 4.2.1, ffprobe 4.2.1
[debug] Proxy map: {}
[facebook] Downloading login page
[facebook] Logging in
[facebook] 2838450249750627: Downloading webpage
[facebook] 2838450249750627: Downloading webpage
ERROR: Cannot parse data; 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 "/data/data/com.termux/files/usr/lib/python3.8/site-packages/youtube_dl/YoutubeDL.py", line 806, in wrapper
    return func(self, *args, **kwargs)
  File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/youtube_dl/YoutubeDL.py", line 827, in __extract_info
    ie_result = ie.extract(url)
  File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/youtube_dl/extractor/common.py", line 534, in extract
    ie_result = self._real_extract(url)
  File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/youtube_dl/extractor/facebook.py", line 677, in _real_extract
    return self._extract_from_url(real_url, video_id)
  File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/youtube_dl/extractor/facebook.py", line 591, in _extract_from_url
    raise ExtractorError('Cannot parse data')
youtube_dl.utils.ExtractorError: Cannot parse data; 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

When trying to download a video from a private group, I would need atleast to login with my password and username for me to access those video. When trying to download those video (here on Termux app) I get an error from youtube-dl and facebook would prompt a verification on google chrome. Screenshot_20210511-101149

balianus commented 3 years ago

I have the same exact problem.

bonacker1 commented 3 years ago

A couple of weeks ago I had a similar, but not exactly the same, issue with Facebook. I resolved it as follows. (I don't know if this will work for you, and I don't understand why the coders here haven't commented on this issue.)

Using the yt-dl --username --password option with Facebook caused serious problems for the Facebook account I was using. Once you get that suspicious activity block from FB, you have to go through the steps to remove it before FB will work on any device. You have to prove you are not suspicious using one of the ways they suggest.

The better method for downloading private or other videos that seem to want a login on yt-dl is to use the --cookies option. This has worked for me and has never caused FB to start blocking my login even when --cookies hasn't worked. Others here have cautioned about using --username --password. I would advise against using it with Facebook.

To use --cookies, you have to make a text file from the cookies stored in the browser in which you have recently (within a few hours) logged in successfully on FB. Then put --cookies PathToCookie-text-file\name-of-cookie-text-file in your yt-dl command.

There are many little addons or programs that make a text file from cookies in various browsers. I use an addon in Firefox that is very simple and works well: cookies.txt 0.1 by Lennon Hill https://github.com/lennonhill/cookies-txt. This places a button on Firefox that when clicked makes a cookies.txt file wherever you want to save it to.

I also use Termux on Android. I make the cookies.txt file on a desktop and copy it to the tablet root directory and then, on the mobile device, copy the file into Termux's file system. It works, but I don't know if mobile Firefox can use the addon to make the cookie file.

harieamjari commented 3 years ago

A couple of weeks ago I had a similar, but not exactly the same, issue with Facebook. I resolved it as follows. (I don't know if this will work for you, and I don't understand why the coders here haven't commented on this issue.)

Using the yt-dl --username --password option with Facebook caused serious problems for the Facebook account I was using. Once you get that suspicious activity block from FB, you have to go through the steps to remove it before FB will work on any device. You have to prove you are not suspicious using one of the ways they suggest.

The better method for downloading private or other videos that seem to want a login on yt-dl is to use the --cookies option. This has worked for me and has never caused FB to start blocking my login even when --cookies hasn't worked. Others here have cautioned about using --username --password. I would advise against using it with Facebook.

To use --cookies, you have to make a text file from the cookies stored in the browser in which you have recently (within a few hours) logged in successfully on FB. Then put --cookies PathToCookie-text-file\name-of-cookie-text-file in your yt-dl command.

There are many little addons or programs that make a text file from cookies in various browsers. I use an addon in Firefox that is very simple and works well: cookies.txt 0.1 by Lennon Hill https://github.com/lennonhill/cookies-txt. This places a button on Firefox that when clicked makes a cookies.txt file wherever you want to save it to.

I also use Termux on Android. I make the cookies.txt file on a desktop and copy it to the tablet root directory and then, on the mobile device, copy the file into Termux's file system. It works, but I don't know if mobile Firefox can use the addon to make the cookie file.

Sounds like more extra step instead of a simple one.