Created
June 21, 2018 02:33
-
-
Save adinbied/1c3673280fa0970297af01b03ce40227 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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