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/fbf4fe0374d017cac1fd to your computer and use it in GitHub Desktop.
Save Drunkar/fbf4fe0374d017cac1fd to your computer and use it in GitHub Desktop.
import urllib
import json
NUM = 1
url = 'https://www.hogehoge.com?'
params = {
'param1':'para',
'param2':'para',
}
f = open('hogehoge.json','w')
results = []
for i in range(0,NUM):
req_url = url + urllib.urlencode(params)
res = urllib.urlopen(req_url)
dump = json.loads(res.read())
for item in dump["items"]:
print item["link"]
f.write(json.dumps(results) + "\n")
if not dump['queries'].has_key('nextPage'):
break
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment