Hi, I don’t have any experience with the vocabulary feature. But here is an attempt:
Summary
import requests
import json
KEY = "1234"
url = 'https://www.lingq.com/api/v3/es/cards/'
params = {
'page': 1,
'page_size': 25,
'search_criteria': 'startsWith',
'sort': 'date',
'status': [0, 1, 2, 3, 4]
}
headers = {
'Authorization': 'Token ' + KEY,
'accept': 'application/json'
}
response = requests.get(url, params=params, headers=headers)
if response.status_code == 200:
data = response.json()
if 'results' in data and len(data['results']) > 0:
first_result = data['results'][0]
formatted_json = json.dumps(first_result, indent=4)
print(formatted_json)
else:
print("No results")
else:
print(f"Request failed with status code: {response.status_code}")
Results look something like this for me:
Summary
"pk": 465545775,
"url": "https://www.lingq.com/api/v3/es/cards/465545775/",
"term": "embajada",
"fragment": "con la Embajada de Estados Unidos, que",
"importance": 1,
"status": 0,
"extended_status": null,
"last_reviewed_correct": null,
"srs_due_date": "2023-10-01T14:59:53.832370",
"notes": "",
"audio": null,
"words": [
"embajada"
],
"tags": [],
"hints": [
{
"id": 98297,
"locale": "en",
"text": "embassy",
"term": "embajada",
"popularity": 1609,
"is_google_translate": true,
"flagged": false
}
],
"transliteration": {},
"gTags": [
"sustantivo"
],
"wordTags": [
"sustantivo"
],
"readings": {},
"writings": [
"embajada"
]
Technically some documentation exists, it’s just incomplete and about 8 years out of date.
https://www.lingq.com/apidocs/
but none of the pages I browse to seem to exercise this kind of API.
This one:
https://www.lingq.com/en/learn/es/web/library/vocabulary/all