Skip to content

Instantly share code, notes, and snippets.

import sys
import requests
for id in sys.argv[1:]:
baseurl = 'https://api.quizlet.com/2.0/sets/'
afterurl = '?client_id=<apikey>'
fullurl = baseurl + str(id) + 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)
if r.status_code == 200:
open(str(id) + '.txt', 'wb').write(r.content)
{"id":1041,"url":"https://quizlet.com/1041/physics-chapter-21-22-vocab-flash-cards/","title":"Physics Chapter 21-22 Vocab","created_by":"tylerhowarth","term_count":15,"created_date":1169087215,"modified_date":1456932080,"published_date":1169087215,"has_images":false,"subjects":[],"visibility":"public","editable":"only_me","has_access":true,"can_edit":false,"description":"Vocab for Dean Knight's CP physics class","lang_terms":"en","lang_definitions":"en","password_use":0,"password_edit":0,"access_type":2,"creator_id":274,"creator":{"username":"tylerhowarth","account_type":"free","profile_image":"https://quizlet.com/a/i/animals/53.ATwS.jpg","id":274},"class_ids":[],"terms":[{"id":32336,"term":"Absolute Zero","definition":"The temperature at which a substance has no kinetic energy to give up. 0 K","image":null,"rank":0},{"id":32337,"term":"Celsius Scale","definition":"A temperature scale in which the number number 0 is assigned to temperature at which water freezes, and the number 100 is assigned to the temperat
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: