First commit

This commit is contained in:
Henrik Berglund
2022-03-25 15:17:04 +01:00
commit e3d9d8eb7f

35
listStory.py Normal file
View File

@@ -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'])