-
-
Notifications
You must be signed in to change notification settings - Fork 409
Description
Once upon a time, the url plugin's title_auto feature would check if a link redirected to a URL that should be handled by another plugin, but that appears to no longer be the case since the conversion to use requests. Its documentation and that for the process_urls helper (below) still say this is the case, but the behavior is gone.
Lines 290 to 295 in d36a19d
| def title_auto(bot, trigger): | |
| """ | |
| Automatically show titles for URLs. For shortened URLs/redirects, find | |
| where the URL redirects to and show the title for that (or call a function | |
| from another plugin to give more information). | |
| """ |
Lines 322 to 329 in d36a19d
| def process_urls(bot, trigger, urls): | |
| """ | |
| For each URL in the list, ensure that it isn't handled by another plugin. | |
| If not, find where it redirects to, if anywhere. If that redirected URL | |
| should be handled by another plugin, dispatch the callback for it. | |
| Return a list of (title, hostname) tuples for each URL which is not handled | |
| by another plugin. | |
| """ |
I would argue that this is a useful feature, and we should bring it back. For example, our first-party GitHub plugin could get free handling of repo/issue/PR/commit links shortened through git.io if this was still the case. Any shortened URL at present, actually, is only ever going to get the generic title-fetching behavior.
While it's certainly possible to create Yet Another Sopel Plugin that resolves short URLs, it would be fairly annoying to implement—and it wouldn't block the built-in title handling, either.
Note, I don't care if this is part of url, but it makes more sense to put it there than into the bot's core URL handling. We don't necessarily want the core bot making HTTP requests every time it sees a link. Some of the thoughts in this issue were previously expressed in #sopel@libera on 2021-11-30.