Skip to content

Instantly share code, notes, and snippets.

@satoshihirose
Created November 10, 2014 18:03
Show Gist options
  • Save satoshihirose/82cbe11da2851de01298 to your computer and use it in GitHub Desktop.
Save satoshihirose/82cbe11da2851de01298 to your computer and use it in GitHub Desktop.
アメブロの画像ダウンローダ
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
from BeautifulSoup import BeautifulSoup as Soup
import os
import time
start_url = 'http://ameblo.jp/gekidanherbest/image-11950650243-13125199892.html'
browser = webdriver.Firefox()
browser.get(start_url)
while True:
button = browser.find_element_by_css_selector('#nextNavi')
Hover = ActionChains(browser).move_to_element(button)
Hover.click(button)
Hover.perform()
img = browser.find_element_by_css_selector('#imgItem')
url = img.get_attribute('src')
print url
os.system('wget -q ' + url)
time.sleep(1)
@satoshihirose
Copy link
Author

python+seleniumで書いたameble画像ダウンローダです。
start_urlを対象のブログの最新記事の画像をクリックして表示されるページのURLに書き換えてください。

sudo pip install selenium BeautifulSoup
python amebloader.py

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