Created
February 12, 2013 11:15
-
-
Save rchrand/4761638 to your computer and use it in GitHub Desktop.
Xkcd comic script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bs4 import BeautifulSoup | |
import requests | |
import os | |
images = [] | |
final = "" | |
r = requests.get('http://xkcd.com/') | |
soup = BeautifulSoup(r.content) | |
for imgs in soup.find_all('img'): | |
images.append(imgs.get('src')) | |
for text in images: | |
if "comic" in text: | |
final = text | |
os.system("wget " + final) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment