From e3d9d8eb7f92471e88ff264e89549089baa3e959 Mon Sep 17 00:00:00 2001 From: Henrik Berglund Date: Fri, 25 Mar 2022 15:17:04 +0100 Subject: [PATCH] First commit --- listStory.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 listStory.py diff --git a/listStory.py b/listStory.py new file mode 100644 index 0000000..0c9ab12 --- /dev/null +++ b/listStory.py @@ -0,0 +1,35 @@ +import requests +import time +import json + +authors = [] + +i = True + +def getauthors(): + start = 3965 + while i: + tmpauthors = [] + print(start) + r = requests.get(f'https://www.storytel.se/api/getSmartList.action?orderBy=LETTER&filterKeys=AUTHOR&filterValues=*&listTitle=*&start={start}&hits=50') + j = json.loads(r.content) + for a in j['books']: + for b in a['book']['authors']: + if b['name'] not in authors: + print(b['name']) + authors.append(b['name']) + tmpauthors.append(b['name']) + r.close() + start = start + len(tmpauthors) + if len(tmpauthors) == 0: + break + if len(tmpauthors) <= 15: + time.sleep(312) + else: + time.sleep(32) + + +for a in r['books']: + for b in a['book']['authors']: + print(b['name']) +