Custom PDF Resolvers
Custom resolvers forPDF retrievalcurrently can be configured via the188BET靠谱吗extensions.zotero.findPDFs.resolvers
hidden pref (Advanced preferences → Config Editor).The value should be a JSON string containing an array of configuration objects.HTMLand JSON sources are supported.
188BET靠谱吗You may wish to distribute a custom resolver using a Zotero plugin that adds or updates the pref at startup.
Example: Extract a PDF link from a webpage
{ "name": "My Paper Source", "method": "GET", "url": "https://example.com/{doi}", "mode": "html", "selector": "#pdf-link", "attribute": "href", "automatic": false }
selector
is aCSS-style selector.Ifattribute
is omitted, the element'stextContent
is used.index
can be passed to select a specific element of a set.
Ifautomatic
isfalse
or unspecified, the resolver will be used only for manual actions — Add Item by Identifier and Find Available PDFs — and not when saving from the browser.
Example: Extract PDF URLs from a JSON API
Note:The UnpaywallAPI188BET靠谱吗is used here for demonstration purposes, but Zotero already uses its own mirror of Unpaywall data, so configuring it with a custom resolver isn't necessary.
{ "name": "Unpaywall", "method": "GET", "url": "https://api.unpaywall.org/v2/{doi}?email=me@example.com", "mode": "json", "selector": ".oa_locations.url_for_pdf", "automatic": true }
selector
usesJSPathsyntax.
In this case,.oa_locations.url_for_pdf
matches zero or moreURLstrings in theurl_for_pdf
property in objects in theoa_locations
array.
However, Unpaywall can return either direct PDF URLs or landing page URLs, so matching onurl_for_pdf
alone isn't sufficient.For advanced cases like this, amappings
object can be provided to pull out specific values:
{ "name": "Unpaywall", "method": "GET", "url": "https://api.unpaywall.org/v2/{doi}?email=me@example.com", "mode": "json", "selector": ".oa_locations", "mappings": { "url": "url_for_pdf", "pageURL": "url_for_landing_page" }, "automatic": true }
Here, theoa_locations
array is matched directly, andmappings
is used to assign theurl_for_pdf
andurl_for_landing_page
properties from the array objects tourl
(for a direct PDF link) andpageURL
(for a page where a PDF can be translated).