A simple plugin to refetch poorly defined titles in YOURLS
Sometimes YOURLS does not fetch the title of a url that is being processed, this happens frequently when using the api with certain 3rd party applications (which need attention from their developers). When this occures YOURLS uses the url itself as the title in the databse, which is less than desireable.
Also, sometimes a website will update the title of an article or post. When displaying a preview page it would be desireable to have the most up-to-date titles of pages on display.
This plugin adds a new key->value
pair to action=shorturl
, and if it is present will check the title of the new link and attempt to repair it if it is malformed.
Extract the title-refetch
folder in this repo into the YOURLS/user/plugins/
directory and enable it in the admin interface.
- Send the
refetch=true
along with a typical API shorturl call. Ex:
https://eg.com/yourls-api.php?refetch=true&action=shorturl&url=https://some.really.long.url.com/it_never/ends/index.php
- This plugin also creates a new api action:
action=refetch
which will trigger a refetch check according to one of the following required conditions:target=title
which will check a single link and requiresshorturl=EX
. The short url can be a keyword or a full short url.target=title-force
skips the malformed url check and just looks for an updated title. Requiresshorturl=EX
.target=all
which will run a check on the entire database and requires a valid log in (eg. signature or user/pass)
- There is an action button in the admin section to force-update single links at a a time.
Note: This button is filtered by AuthMgrPlus with the
EditURL
capability, if installed.
While this doesn't cause the developers of third party applications to give attetnion to their code, it does make integration more flexible and provides an immediate working solution on YOURLS's end, akin to the api-concurrence-fix plugin.
This module was initially developed to assist with integration of the Drupal: Shorten URLs module. An issue regarding this can be found here.
Dogecoin: DARhgg9q3HAWYZuN95DKnFonADrSWUimy3