Sorry, was afk for a moment. To enable this for all lessons, not just your own, use a different url. This also simplifies the code get_indexes function. I don’t think we can get away with just one API version unfortunately. Maybe give this a try:
Summary
INDEX_URL = f'https://www.lingq.com/api/v3/{LANGUAGE}/lessons/{LESSON_ID}/sentences/'
def get_indexes():
response = requests.get(INDEX_URL, headers=HEADERS)
if response.status_code == 200:
data = response.json()
indexes = []
for item in data:
index = item.get('index')
indexes.append(index)
return indexes
else:
print(f'Error: {response.status_code}\nResponse: {response.text}')
return []