Skip to content

Instantly share code, notes, and snippets.

@bhaavanmerchant
Created April 10, 2017 16:01
Show Gist options
  • Save bhaavanmerchant/3ab9e5114f3b0340139a9a4079ce21ba to your computer and use it in GitHub Desktop.
Save bhaavanmerchant/3ab9e5114f3b0340139a9a4079ce21ba to your computer and use it in GitHub Desktop.
from bs4 import BeautifulSoup
import urllib2
soup = BeautifulSoup(html_doc, 'http://m.xkcd.com')
try:
img = urllib2.urlopen(soup.find_all(id='comic')[1].get_src()).read()
# do facebook stuff here
except:
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment