You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for every link that matches entries anchor CSS selector
create an entry from the element that matches content CSS selector
Instead of magic-content, we could also use some library that guesses what the content is (there must be some out there).
In its best form, this should also cover the functionality of the sqlite_releases plugin. Of note is that magic-content wouldn't work here, since there's no container for the whole content; also, some of the old versions don't actually have a link.
This will also be a good test of the internal retriever/parser API we implemented in #205.
after a quick look at the above, only python-readability preserves the spans used for code highlighting (we want to preserve as much HTML as possible); it also seems to have a sanitization feature (related to Fix sanitization #157)
Some thoughts about how to implement this in the parser:
If there are multiple things to be retrieved, we can't return them as a single file object; also, we may fabricate "composite" caching headers. I see two options:
do all of the parsing in retriever, and return (feed, entries) directly, bypassing parser (I like this one)
make the result.http_etag etc. a property that raises an exception if accessed before result.file is actually parsed; seems hacky; get_parser_by_url() would need to support more than exact matching
The first one would look something like this:
# RetrieveResult is renamed to FileResult, and in its place there's an union.# RetrieverType continues to return ContextManager[Optional[RetrieveResult]]RetrieveResult=Union[FileResult, ParsedFeed]
# class Parser:def__call__(self, url, http_etag, http_last_modified):
parser=self.get_parser_by_url(url)
...
# Must be able to match schemes like magic+http://.# Note that prefix match is not enough, # magic+file.txt == file:///magic+file.txt;# normalizing the URL beforehand could work.retriever=self.get_retriever(url)
withretriever(url, http_etag, http_last_modified, ...) asresult:
ifnotresult:
returnNone# Parsing already done, return the result (this is new).ifisinstance(result, ParsedFeed):
returnresult# Continue with the old logic.ifnotparser:
...
feed, entries=parser(url, result.file, result.headers)
returnParsedFeed(feed, entries, result.http_etag, result.http_last_modified)
Activity
lemon24 commentedon Apr 27, 2021
Some thoughts about how to implement this in the parser:
If there are multiple things to be retrieved, we can't return them as a single file object; also, we may fabricate "composite" caching headers. I see two options:
The first one would look something like this: