Skip to content

Instantly share code, notes, and snippets.

@Drunkar
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Drunkar/30f8f7dd446f851b311d to your computer and use it in GitHub Desktop.
Save Drunkar/30f8f7dd446f851b311d to your computer and use it in GitHub Desktop.
import urllib
from BeautifulSoup import BeautifulStoneSoup
NUM = 1
url = 'http://www.hogehoge.com?'
params = {
'param1':'para',
'param2': 'para'
}
results = []
for i in range(0,NUM):
try:
req_url = url + urllib.urlencode(params)
res = urllib.urlopen(req_url)
soup = BeautifulStoneSoup(res.read())
break
except:
continue
print soup.prettify()
links = soup.findAll('list_inf')
for link in links:
print link["id"]
print link
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment