feat: support two-step OpenSearch Description for OPDS search
Servers like copyparty advertise search via a link to an OpenSearch
Description (OSD) document rather than embedding {searchTerms} directly
in the feed's <link rel="search"> href (the Calibre-Web style).
OpdsParser now stores the OSD URL when rel="search" and
type="application/opensearchdescription+xml" but the href lacks
{searchTerms}. OpdsBookBrowserActivity fetches that OSD document after
each feed load and parses the <Url template="..."> element with a
minimal inline expat parser to extract the actual search template.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
committed by
jpirnay
co-authored by
Claude Sonnet 4.6
parent
bd43221ad9
commit
b47e5b5fff
@@ -70,6 +70,7 @@ bool OpdsParser::error() const { return errorOccured; }
|
||||
void OpdsParser::clear() {
|
||||
entries.clear();
|
||||
searchTemplate.clear();
|
||||
osdUrl.clear();
|
||||
nextPageUrl.clear();
|
||||
prevPageUrl.clear();
|
||||
currentEntry = OpdsEntry{};
|
||||
@@ -105,6 +106,8 @@ void XMLCALL OpdsParser::startElement(void* userData, const XML_Char* name, cons
|
||||
std::string sHref(href);
|
||||
if (sHref.find("{searchTerms}") != std::string::npos) {
|
||||
self->searchTemplate = sHref;
|
||||
} else if (type && strcmp(type, "application/opensearchdescription+xml") == 0) {
|
||||
self->osdUrl = sHref;
|
||||
}
|
||||
} else if (rel && strcmp(rel, "next") == 0 && !self->inEntry) {
|
||||
self->nextPageUrl = href;
|
||||
|
||||
Reference in New Issue
Block a user