Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import requests
count = 1
while count < 3000000:
baseurl = 'https://api.quizlet.com/2.0/sets/'
afterurl = '?client_id=<apikey>'
fullurl = baseurl + str(count) + afterurl
headers = {'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36'}
r = requests.get(fullurl, headers=headers)
# make sure that the page exist
if r.status_code == 200:
open(str(count) + '.txt', 'wb').write(r.content)
print "Saved Set Number " + str(count) + "!"
count = count + 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment