[fix] engine annas archive - fetch traits (modified xpath selectors)

Anna’s Archive has cleaned up their languages, available file extensions and
changed the HTML form.

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser 2023-09-26 11:00:08 +02:00 committed by Markus Heiser
parent 1f835a9f1f
commit 3a456b1282
2 changed files with 12 additions and 64 deletions

View File

@ -3,38 +3,24 @@
"all_locale": "", "all_locale": "",
"custom": { "custom": {
"content": [ "content": [
"", "book_nonfiction",
"journal_article",
"book_any",
"book_fiction", "book_fiction",
"book_unknown", "book_unknown",
"book_nonfiction", "journal_article",
"book_comic", "book_comic",
"magazine", "magazine",
"standards_document" "standards_document"
], ],
"ext": [ "ext": [
"",
"pdf", "pdf",
"epub", "epub",
"cbr", "cbr",
"fb2",
"mobi", "mobi",
"fb2",
"cbz", "cbz",
"djvu",
"azw3", "azw3",
"fb2.zip", "djvu",
"txt", "fb2.zip"
"rar",
"zip",
"doc",
"lit",
"rtf",
"htm",
"html",
"lrf",
"mht",
"docx"
], ],
"sort": [ "sort": [
"", "",
@ -48,84 +34,46 @@
"languages": { "languages": {
"af": "af", "af": "af",
"ar": "ar", "ar": "ar",
"az": "az",
"be": "be", "be": "be",
"bg": "bg", "bg": "bg",
"bn": "bn", "bn": "bn",
"bo": "bo",
"bs": "bs",
"ca": "ca", "ca": "ca",
"cs": "cs", "cs": "cs",
"cy": "cy",
"da": "da", "da": "da",
"de": "de", "de": "de",
"el": "el", "el": "el",
"en": "en", "en": "en",
"eo": "eo",
"es": "es", "es": "es",
"et": "et",
"eu": "eu",
"fa": "fa", "fa": "fa",
"fi": "fi",
"fil": "tl",
"fr": "fr", "fr": "fr",
"gl": "gl",
"gu": "gu",
"he": "he", "he": "he",
"hi": "hi", "hi": "hi",
"hr": "hr", "hr": "hr",
"hu": "hu", "hu": "hu",
"hy": "hy",
"id": "id", "id": "id",
"is": "is",
"it": "it", "it": "it",
"ja": "ja", "ja": "ja",
"ka": "ka", "jv": "jv",
"kk": "kk", "kk": "kk",
"kn": "kn",
"ko": "ko", "ko": "ko",
"ku": "ku",
"ky": "ky",
"lo": "lo",
"lt": "lt", "lt": "lt",
"lv": "lv", "lv": "lv",
"mk": "mk",
"ml": "ml",
"mn": "mn", "mn": "mn",
"mr": "mr",
"ms": "ms",
"my": "my",
"nb": "nb",
"ne": "ne",
"nl": "nl", "nl": "nl",
"no": "no", "no": "no",
"pa": "pa",
"pl": "pl", "pl": "pl",
"ps": "ps",
"pt": "pt", "pt": "pt",
"ro": "ro", "ro": "ro",
"ru": "ru", "ru": "ru",
"sa": "sa",
"sd": "sd",
"si": "si",
"sk": "sk",
"sl": "sl",
"so": "so",
"sq": "sq",
"sr": "sr", "sr": "sr",
"sv": "sv", "sv": "sv",
"sw": "sw",
"ta": "ta", "ta": "ta",
"te": "te",
"tg": "tg",
"tr": "tr", "tr": "tr",
"tt": "tt",
"ug": "ug",
"uk": "uk", "uk": "uk",
"ur": "ur",
"uz": "uz",
"vi": "vi", "vi": "vi",
"yi": "yi", "zh": "zh",
"zh": "zh" "zh_Hant": "zh-Hant"
}, },
"regions": {} "regions": {}
}, },

View File

@ -159,7 +159,7 @@ def fetch_traits(engine_traits: EngineTraits):
# supported language codes # supported language codes
lang_map = {} lang_map = {}
for x in eval_xpath_list(dom, "//form//select[@name='lang']//option"): for x in eval_xpath_list(dom, "//form//input[@name='lang']"):
eng_lang = x.get("value") eng_lang = x.get("value")
if eng_lang in ('', '_empty', 'nl-BE', 'und'): if eng_lang in ('', '_empty', 'nl-BE', 'und'):
continue continue
@ -177,10 +177,10 @@ def fetch_traits(engine_traits: EngineTraits):
continue continue
engine_traits.languages[sxng_lang] = eng_lang engine_traits.languages[sxng_lang] = eng_lang
for x in eval_xpath_list(dom, "//form//select[@name='content']//option"): for x in eval_xpath_list(dom, "//form//input[@name='content']"):
engine_traits.custom['content'].append(x.get("value")) engine_traits.custom['content'].append(x.get("value"))
for x in eval_xpath_list(dom, "//form//select[@name='ext']//option"): for x in eval_xpath_list(dom, "//form//input[@name='ext']"):
engine_traits.custom['ext'].append(x.get("value")) engine_traits.custom['ext'].append(x.get("value"))
for x in eval_xpath_list(dom, "//form//select[@name='sort']//option"): for x in eval_xpath_list(dom, "//form//select[@name='sort']//option"):