tonyflo / facebook-download-photos

Download all of your Facebook photos
GNU General Public License v3.0
27 stars 7 forks source link

Downloading fine but then stops ... #4

Open gramico92 opened 1 year ago

gramico92 commented 1 year ago

Hey! Total n00b here - needed a quick an easy way to download my FB photos because I have so many of them (and this is PERFECTION). However, when it gets to a certain place, it stops:

Traceback (most recent call last): File "download.py", line 204, in go() File "download.py", line 127, in go download(browser, username, album, sequence) File "download.py", line 143, in download script_tag = browser.find_element(By.XPATH, xpath_str) File "/Users/gramico92/env/fb/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 830, in find_element return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"] File "/Users/gramico92/env/fb/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 440, in execute self.error_handler.check_response(response) File "/Users/gramico92/env/fb/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 245, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//script[contains( text( ), 'image":{"uri')]"} (Session info: chrome=109.0.5414.119) Stacktrace: 0 chromedriver 0x00000001032e3fa8 chromedriver + 4886440 1 chromedriver 0x0000000103261643 chromedriver + 4351555 2 chromedriver 0x0000000102eafb27 chromedriver + 477991 3 chromedriver 0x0000000102ef476c chromedriver + 759660 4 chromedriver 0x0000000102ef49c1 chromedriver + 760257 5 chromedriver 0x0000000102f38204 chromedriver + 1036804 6 chromedriver 0x0000000102f1a5fd chromedriver + 914941 7 chromedriver 0x0000000102f355fe chromedriver + 1025534 8 chromedriver 0x0000000102f1a3a3 chromedriver + 914339 9 chromedriver 0x0000000102ee457f chromedriver + 693631 10 chromedriver 0x0000000102ee5b1e chromedriver + 699166 11 chromedriver 0x00000001032b0b9e chromedriver + 4676510 12 chromedriver 0x00000001032b591e chromedriver + 4696350 13 chromedriver 0x00000001032bd19f chromedriver + 4727199 14 chromedriver 0x00000001032b681a chromedriver + 4700186 15 chromedriver 0x0000000103289a62 chromedriver + 4516450 16 chromedriver 0x00000001032d58c8 chromedriver + 4827336 17 chromedriver 0x00000001032d5a45 chromedriver + 4827717 18 chromedriver 0x00000001032eb7ef chromedriver + 4917231 19 libsystem_pthread.dylib 0x00007fff208fe8fc _pthread_start + 224 20 libsystem_pthread.dylib 0x00007fff208fa443 thread_start + 15

(fb) gramico92@Ginas-MacBook-Pro facebook-download-photos %

tonyflo commented 1 year ago

Are you able to provide a link to the FB profile so I can debug?

gramico92 commented 1 year ago

Hi, here's the link to the FB profile: https://www.facebook.com/TheGinaColada

On Sat, Mar 11, 2023 at 11:49 PM Tony Flo @.***> wrote:

Are you able to provide a link to the FB profile so I can debug?

— Reply to this email directly, view it on GitHub https://github.com/tonyflo/facebook-download-photos/issues/4#issuecomment-1465092371, or unsubscribe https://github.com/notifications/unsubscribe-auth/A54F2SV2BMTERPLX66DQSYTW3VIXBANCNFSM6AAAAAAU3TKXIQ . You are receiving this because you authored the thread.Message ID: @.***>

--

tonyflo commented 1 year ago

After some testing, it seems like Facebook temporarily blocks the script after a large number of downloads. I got this "You're Temporarily Blocked" error page from Facebook before the script closes.

It looks like you were misusing this feature by going too fast. You’ve been temporarily blocked from using it.

facebook-youre-temporarily-blocked

I will work on a fix and get back to you with a solution.

gramico92 commented 1 year ago

Thank you! So appreciated!!

On Wed, Mar 15, 2023 at 2:08 AM Tony Flo @.***> wrote:

After some testing, it seems like Facebook temporarily blocks the script after a large number of downloads. I got this "You're Temporarily Blocked" error page from Facebook before the script closes.

It looks like you were misusing this feature by going too fast. You’ve been temporarily blocked from using it.

[image: facebook-youre-temporarily-blocked] https://user-images.githubusercontent.com/6558850/225220855-c47b845c-f5fa-48e8-8cbd-75ecf8e2d0e2.png

I will work on a fix and get back to you with a solution.

— Reply to this email directly, view it on GitHub https://github.com/tonyflo/facebook-download-photos/issues/4#issuecomment-1469398006, or unsubscribe https://github.com/notifications/unsubscribe-auth/A54F2SUNVZUZE2KN7OKIF2DW4FMERANCNFSM6AAAAAAU3TKXIQ . You are receiving this because you authored the thread.Message ID: @.***>

--

tonyflo commented 1 year ago

I added a default timeout of 2 seconds in between photo downloads. I'm not 100% sure this will prevent FB from doing a temporarily block, but if not you can try a longer timeout like this:

python download.py --timeout 5

Please let me know if this works for you.

Pelezi commented 5 months ago

I made a fork and added something that might help with that When the console prints the "Downloading {photoid}" I added another line that prints the photo url as well

And also a new argument where you can add the url of the last downloaded photo, if the first photo it tries to download is already downloaded then it goes to the url of the last downloaded photo, that is if you provide one of course, the argument is optional

I don't know if this is the best solution, but this is what worked for me, I'm trying to download like 4k photos so it's faster this way lol, when it stops I just copy the last url printed in the console before crashing and it keeps going from there

Anyway I made a pull request and Left my fork public so if you want to check it out and see if it works for you idk

nicokovasa commented 2 months ago

I made a fork and added something that might help with that When the console prints the "Downloading {photoid}" I added another line that prints the photo url as well

And also a new argument where you can add the url of the last downloaded photo, if the first photo it tries to download is already downloaded then it goes to the url of the last downloaded photo, that is if you provide one of course, the argument is optional

I don't know if this is the best solution, but this is what worked for me, I'm trying to download like 4k photos so it's faster this way lol, when it stops I just copy the last url printed in the console before crashing and it keeps going from there

Anyway I made a pull request and Left my fork public so if you want to check it out and see if it works for you idk

@Pelezi Hey I love this! But I can't figure out how to make it work ... I'm entering this argument

python download.py -e you@example.com -p password -a of -l https://www.facebook.com/photo/?fbid=1910403532365024&set=t.100001861866258

and I'm getting this

zsh: no matches found: https://www.facebook.com/photo/?fbid=1910403532365024

am I doing it wrong?

tonyflo commented 2 months ago

This program will download all of your photos, so it's not necessary to provide the URL of an individual photo. Your command needs to look like this: python download.py -e you@example.com -p password -a of

Pelezi commented 2 months ago

I made a fork and added something that might help with that When the console prints the "Downloading {photoid}" I added another line that prints the photo url as well And also a new argument where you can add the url of the last downloaded photo, if the first photo it tries to download is already downloaded then it goes to the url of the last downloaded photo, that is if you provide one of course, the argument is optional I don't know if this is the best solution, but this is what worked for me, I'm trying to download like 4k photos so it's faster this way lol, when it stops I just copy the last url printed in the console before crashing and it keeps going from there Anyway I made a pull request and Left my fork public so if you want to check it out and see if it works for you idk

@Pelezi Hey I love this! But I can't figure out how to make it work ... I'm entering this argument

python download.py -e you@example.com -p password -a of -l https://www.facebook.com/photo/?fbid=1910403532365024&set=t.100001861866258

and I'm getting this

zsh: no matches found: https://www.facebook.com/photo/?fbid=1910403532365024

am I doing it wrong?

I'm not sure, but I believe the url should be between quotation marks, it's been a while since i've used it lol

Pelezi commented 2 months ago

This program will download all of your photos, so it's not necessary to provide the URL of an individual photo. Your command needs to look like this: python download.py -e you@example.com -p password -a of

I added this because when downloading a lot of photos sometimes it will just stop working without a reason, I don't know if it is a facebook block or something, but even if I set a higher timeout it happens, and if I run it again it just stops again at the same spot, adding a custom url and jumping to that when it sees that the first photo was downloaded already is what worked for me