-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle redirects and gone feeds gracefully #246
Comments
Related comment: Lines 460 to 461 in 836ff81
Misc thoughts:
|
Just a thought. Consider API semantics that allows for a plugin to only mark feed url for a change. Then, after processing all of the plugins, you check if any plugin requested a change (and maybe make sure only one did it?), and make the change itself as part of the processing mechanism that runs outside of the plugins. This is subtle change, but that way you (probably) can drop requirement that such plugin must run as a last one. Also, this seem to simplify issues you mention in the last point and allows for controlling if such request makes sense in the context of any other plugins or other external factors that may occur. EDIT: typo |
@zifot, that's actually a great idea, thank you! I think it's doable right now with tags: def after_feed_update(reader, feed, ...):
# runs for each feed
new_url = is_permanent_redirect(feed, ...)
if new_url:
reader.set_tag(feed, '.url-change-needed', new_url)
def after_feeds_update(reader):
# runs after all the feeds
for feed in reader.get_feeds(tags=['.url-change-needed']):
new_url = reader.get_tag(feed, '.url-change-needed')
# for later: how do we deal with InvalidFeedURLError?
reader.change_feed_url(feed, new_url)
reader.delete_tag(new_url, '.url-change-needed') Note to self: This seems like a very useful pattern, mention it in the docs for plugin authors (when we have them). The way we're handling .reader.dedupe.once for entry_dedupe is vaguely similar (mark, then change). |
https://feedparser.readthedocs.io/en/latest/http-redirect.html
The text was updated successfully, but these errors were encountered: