Skip to content

Instantly share code, notes, and snippets.

@shikajiro
Created April 25, 2017 15:01
Show Gist options
  • Save shikajiro/4822373cf24ae09ff5a6944c87038de2 to your computer and use it in GitHub Desktop.
Save shikajiro/4822373cf24ae09ff5a6944c87038de2 to your computer and use it in GitHub Desktop.
facebookのグループの写真全てを順番にダウンロードしていく
# coding=utf-8
import time
from selenium import webdriver
if __name__ == '__main__':
try:
browser = webdriver.Chrome('./chromedriver')
browser.get('https://www.facebook.com/groups/{group_page}/photos/')
time.sleep(1)
email = browser.find_element_by_name("email")
email.send_keys("[email protected]")
password = browser.find_element_by_name("pass")
password.send_keys("password")
login = browser.find_element_by_name("login")
login.click()
time.sleep(1)
for thumb in browser.find_elements_by_class_name("uiMediaThumb"):
thumb.click()
time.sleep(1)
browser.find_element_by_class_name("fbPhotoSnowliftDropdownButton").click()
time.sleep(1)
browser.find_element_by_link_text("ダウンロード").click()
time.sleep(3)
browser.find_element_by_class_name("_xlt").click()
time.sleep(1)
print(browser.title)
finally:
print('.......END.......')
# browser.quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment