Skip to content

Instantly share code, notes, and snippets.

@judell
Created April 29, 2015 22:35
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 judell/f794f719a5240de9f939 to your computer and use it in GitHub Desktop.
Save judell/f794f719a5240de9f939 to your computer and use it in GitHub Desktop.
all annotations
import json, urllib2, re
offset = 0
limit = 200
more = True
def search():
global offset, limit, more
h_url = 'https://hypothes.is/api/search?limit=%d&offset=%d' % ( limit, offset)
s = urllib2.urlopen(h_url).read()
j = json.loads(s)
rows = j['rows']
if len(rows):
for row in rows:
yield row
offset += limit
else:
more = False
rows = []
while more:
for row in search():
rows.append(row)
s = json.dumps(rows)
f = open('c:\\users\\jon\\all_annos.json','w')
f.write(s)
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment