Skip to content

Instantly share code, notes, and snippets.

@adinbied
Created June 21, 2018 02:33
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 adinbied/1c3673280fa0970297af01b03ce40227 to your computer and use it in GitHub Desktop.
Save adinbied/1c3673280fa0970297af01b03ce40227 to your computer and use it in GitHub Desktop.
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