Giter VIP home page Giter VIP logo

webscrapingfacebook's Introduction

WebscrapingFacebook

Download all your personal images + tagged images from Facebook with Selenium

Please click on the image to watch the time lapse on YouTube
Web Scraping Facebook Time Lapse Thumbnail

Why?
Facebook provides an easy tool to save all your information, including
photos, from your profile - straight to your computer.
The only issue is - it only saves YOUR photos, but none of the photos you
were tagged in, hosted on other peoples' profile.
My beautiful Facebook scraper will extract both - your personal photos,
as well as the photos you were tagged in.

Just please adjust the URL inside the code to match the URL of your
own profile/username ("goldie.may.750" will direct you to my empty account)


Another thing to keep in mind - it's not the first time I'm building this scraper,
and it seems that Facebook is dynamically adjusting its' own code to prevent
scrapers like this from working properly. My last scraper became obsolete 2 days
(2 DAYS!!!) after I created it and downloaded 650+ photos from my personal account.
In case their code changes again, please keep in mind that you might need to adjust
one or two lines to accomodate whatever they changed.

Good luck!

Watch on Youtube:
https://youtu.be/SsXcyoevkV0

Need some extra info?
Checkout my article on Web Scraping Instagram with Selenium:
https://medium.com/analytics-vidhya/web-scraping-instagram-with-selenium-b6b1f27b885

Or checkut my Youtube Channel for more useful projects:
https://www.youtube.com/PythonSimplified

webscrapingfacebook's People

Contributors

mariyasha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

webscrapingfacebook's Issues

...fixes for 2022...

Super helpful project! Got me started with scraping.
Code is broken/outdated due to Selenium changes and FaceBook changes.
Figured I'd give back some minor repairs.
Working code as of 2022/09/05

Extra module to install...
conda install -c conda-forge webdriver-manager

Changes per code block

[1]

# Passing exe path is deprecated, must pass service using ChromeDriverManager
+from selenium.webdriver.chrome.service import Service
+from webdriver_manager.chrome import ChromeDriverManager

[2]

-chrome_options = webdriver.ChromeOptions()
+options = webdriver.ChromeOptions()
prefs = {"profile.default_content_setting_values.notifications" : 2}
-chrome_options.add_experimental_option("prefs",prefs)
+options.add_experimental_option("prefs",prefs)

[3]

# 
images = []
+repos = ["photos_of", "photos_by"]
#...
-driver = webdriver.Chrome('C:/Users/goaim/chromedriver.exe', chrome_options=chrome_options)
+driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))

[4]

-#example: range(0,10) scrolls down 650+ images
+#example: range(0,30) scrolls down ~650 images

#driver.find_elements_by_tag_name is deprecated, use driver.find_elements(By.XXXX,"foo") instead.

-anchors = driver.find_elements_by_tag_name('a')
+anchors = driver.find_elements(By.TAG_NAME,"a")
#...
-img = driver.find_elements_by_tag_name("img")
+img = driver.find_elements(By.TAG_NAME,"img")
#...
#This prints progress. Mariya wrestled with this in the video (Is it running?)
+print(anchorcount," of ",str(len(anchors)))

[6]
#Supplied code breaks if directory already exists... check for directory first.

-os.mkdir(path)
+if not os.path.exists(path):
+       os.mkdir(path)

Working code as of 2022/09/05

Facebook_Scraper - CLEAN.txt

can't download images.

the last code line for downloading the image doesn't working. only icon images are downloaded of same type. as given below:
13

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.