Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save inexxt/9f9f5bab8e8f037bc147eb62b2e0b9b0 to your computer and use it in GitHub Desktop.
Save inexxt/9f9f5bab8e8f037bc147eb62b2e0b9b0 to your computer and use it in GitHub Desktop.

Ok, so facebook is constantly changing something in their apis, the way the page works etc. For now (8 Feb 17) it is not possible to download all photos from conversation.

I've tried:

  • downloading copy of my data - doesn't contain any such photos
  • going to album of shared photos in the converation and then downloading the page - files don't contain images (even thumbnails...)
  • scrolling through the page on which the images appear to load them all, then saving the page, extracting links to the images and scraping them - images don't load in separate window, there is some authentication problem
  • using Chrome extentions - Image downloader, Fatkun downloader - to download the images - extentions don't list the images at all
  • using various versions of FBMessageScraper from github - all of them don't work since facebook changed it's facebook/messages to facebook/messanger
  • trying to get the photos from the iphone messenger - it doesn't have this option
  • manually clicking through the images one at the time and clicking "download" - takes too much time

Finally, I just wrote a little script, which just automates the last option - ie clicks 'right' and left mouse button constantly:

sleep 2
while true ; do 
        # scrot --border '/home/jack/screenshots/%m.%d.%y at %H.%M.%S.png'
        xdotool click 1
        sleep 1
        xte 'keydown Right'
        xte 'keyup Right'
done

You just have to start the script, switch windows, position the mouse on the "download" button - and wait patiently (my ~1000 photos took about 15 minutes).

If you want, you can remove click 1 line and replace it with the scrot - it will take a screenshot instead of downloading (it may be useful when you want to download something else, like a gallery on a webpage, which doesn't have "download" option")

@pkill37
Copy link

pkill37 commented Mar 24, 2019

Cheers!

@stathisch
Copy link

how to enable this script ? where i need to paste it for start working?

@Zatheos
Copy link

Zatheos commented Jun 3, 2019

how to enable this script ? where i need to paste it for start working?

I'm pretty sure this is an AHK (auto hotkey) script - you'll need to download AHK and put this into a script. I recommend doing a little reading about how AHK works and how to choose a hotkey. https://www.autohotkey.com/

@jcgurango
Copy link

What I did was basically the same principle, except I just got the classnames for the "Next" and "Download" button and set it on a 1 second interval to click() them via the JS console. At least with this approach I could use my computer while it downloaded.

@arnobk
Copy link

arnobk commented Jun 14, 2020

What I did was basically the same principle, except I just got the classnames for the "Next" and "Download" button and set it on a 1 second interval to click() them via the JS console. At least with this approach I could use my computer while it downloaded.

Can you share your script?

@xseko
Copy link

xseko commented Mar 31, 2021

I've pasted this into AHK but keep getting an error message at line 3, ''this line does not contain a recognized action''. Anyone knows how to solve this?

@mtracz
Copy link

mtracz commented Apr 2, 2021

Working for me with AutoHotkey 1.1.33.06

Sleep 5000
while (true)
{
        Click
	Sleep 1000
        Send {Right}
        Sleep 1000
}

@Febuso
Copy link

Febuso commented Apr 11, 2021

Working for me with AutoHotkey 1.1.33.06

Sleep 5000
while (true)
{
        Click
	Sleep 1000
        Send {Right}
        Sleep 1000
}

When I position my mouse over download button it just downloads the same photo. How can I fix it?

@pizzatron
Copy link

pizzatron commented Apr 13, 2021

Is there a similar way to auto-unsend facebook messages?
Aka auto run a script that will delete your message without you having to do it one message at a time?

@badjuice
Copy link

Thanks @Febuso, so far your solution worked for me. Save about 4000+ pieces of media but unfortunately it seems that the browser struggles to keep up going back on the list of pictures. I am using Firefox, by the way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment