the public repo for the e-paper bulletin board. It's a bulletin board that syncs over scuttlebutt :)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
535 B

5 months ago
  1. #!/usr/bin/python
  2. # -*- coding:utf-8 -*-
  3. # apparently json.loads doesn't parse multiple entry json??
  4. # So we gotta fux with it
  5. # via https://stackoverflow.com/questions/22112439/valueerror-extra-data-while-loading-json
  6. import json
  7. import re
  8. nonspace = re.compile(r'\S')
  9. def parsy(j):
  10. decoder = json.JSONDecoder()
  11. pos = 0
  12. while True:
  13. matched = nonspace.search(j, pos)
  14. if not matched:
  15. break
  16. pos = matched.start()
  17. decoded, pos = decoder.raw_decode(j, pos)
  18. yield decoded