-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Automatically select a bridge based on a URL #928
Conversation
This adds a new 'detect' action which accepts a URL from which an appropriate bridge is selected and relevant parameters are extracted. The user is then automatically redirected to the selected bridge. For example to get a feed from: https://twitter.com/search?q=%23rss-bridge we could send a request to: '/?action=detect&format=Atom&url=twitter.com/search%3Fq%3D%2523rss-bridge' which would redirect to: '/?action=display&q=%23rss-bridge&bridge=Twitter&format=Atom'. This auto detection happens on a per-bridge basis, so a new function 'detectParameters' is added to BridgeInterface which bridges may implement. It takes a URL for an argument and returns a list of parameters that were extracted, or null if the URL isn't relevant for the bridge.
This adds generic "paramater detection" for bridges that don't have any parameters defined. If the queried URL matches the URI defined in the bridge (ignoring https://, www. and trailing /) an emtpy list of parameters is returned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR, this is an awesome addition! 🥇
Find below a few comments.
I'll push lots of documentation changes in a few minutes (to master), which is why I added comments regarding function documentation to your PR.
Co-Authored-By: Roliga <[email protected]>
Merged. Thanks for adding the changes! Please add some documentation to the Wiki if possible: |
This is wonderful. A game-changer, IMO. Thank you so much for getting it done. |
* core: Add bridge parameter auto detection This adds a new 'detect' action which accepts a URL from which an appropriate bridge is selected and relevant parameters are extracted. The user is then automatically redirected to the selected bridge. For example to get a feed from: https://twitter.com/search?q=%23rss-bridge we could send a request to: '/?action=detect&format=Atom&url=twitter.com/search%3Fq%3D%2523rss-bridge' which would redirect to: '/?action=display&q=%23rss-bridge&bridge=Twitter&format=Atom'. This auto detection happens on a per-bridge basis, so a new function 'detectParameters' is added to BridgeInterface which bridges may implement. It takes a URL for an argument and returns a list of parameters that were extracted, or null if the URL isn't relevant for the bridge. * [TwitterBridge] Add parameter auto detection * [BridgeAbstract] Add generic parameter detection This adds generic "paramater detection" for bridges that don't have any parameters defined. If the queried URL matches the URI defined in the bridge (ignoring https://, www. and trailing /) an emtpy list of parameters is returned.
Hey some time ago I opened #743 and I thought I'd give implementing this feature a shot.
To summarize idea here is to add a new
detect
action which when given a URL automatically redirects the user directly to a feed, similar to the "I'm feeling lucky" feature some search engines have.For example to get a feed from: #rss-bridge on twitter we could send a request to:
/?action=detect&format=Atom&url=twitter.com/search%3Fq%3D%2523rss-bridge
which would redirect to:
/?action=display&q=%23rss-bridge&bridge=Twitter&format=Atom
.My personal use case for this is integration with my web browser: A browser shortcut that sends the current page URL to rss-bridge which then gives me a feed right away.
In #743 it was brought up to use this to display and auto-fill a bridge in the rss-bridge web UI. That'd need some more work, but it should be compatible with the server-side code in this PR I'd imagine!
Either way feedback appreciated! (: