Topic: [Feature] Reformat Twitter image URL links to new format

Posted under General

Requested feature overview description.

Follow-up to topic #34356.

When saving Twitter image URLs in the source field, these URLs may differ between the old and new formats. Detect the old Twitter image URL format and convert it to the new format on upload or when changes to a post are saved.

For instance, if the user adds the following URL format variants:
https://pbs.twimg.com/media/FN_2RQPXEAEbL6R.jpg:orig
https://pbs.twimg.com/media/FN_2RQPXEAEbL6R.jpg?name=orig

Automatically convert them to:
https://pbs.twimg.com/media/FN_2RQPXEAEbL6R?format=jpg&name=orig

Why would it be useful?

Converting the old format to the new format improves consistency across source fields and futureproofs these sources in the event that the old format is eventually deprecated. It also saves users the time and effort of manually changing these URLs to the new format.

What part(s) of the site page(s) are affected?

The upload page, post pages, and the post replacement page.

Sure, why not. I'm sure there are a bunch of other sites where this would make sense. Feel free to post other format conversions here if it is save to convert ALL older format links to the newer one. It needs to work only with the url string, no API calls or things like that. I don't want to implement that and keep it from breaking all the time.

earlopain said:
Feel free to post other format conversions here if it is save to convert ALL older format links to the newer one.

Taking that advice to list some other common cases.

-

Inkbunny adds parameters to the URL string if the viewer selects a different page in a submission or when they click the "Show" MD5 hash button (NSFW):
https://inkbunny.net/s/2535843-p2-#pictop
https://inkbunny.net/s/2535843-p2-#0

These could be trimmed to:
https://inkbunny.net/s/2535843-p2

Note that the first page always omits the -p# suffix.

-

Furaffinity no longer uses facdn links to serve images. Most facdn image links still work, except for links from the brief period where images were served from d2.facdn.net:
https://d.facdn.net/art/fivel/1599788743/1599788743.fivel_365e2fce-3316-4495-927e-f828510f223d.png (still functions)
https://d2.facdn.net/art/fivel/1599788743/1599788743.fivel_365e2fce-3316-4495-927e-f828510f223d.png (broken link)

These could be converted to:
https://d.furaffinity.net/art/fivel/1599788743/1599788743.fivel_365e2fce-3316-4495-927e-f828510f223d.png

There's still new uploads to e621 that include the broken d2 links, visible here: https://e621.net/posts?tags=source%3A*d2.facdn

-

Furaffinity includes a parameter in the URL after uploading an image to the site:
https://www.furaffinity.net/view/47654361/?upload-successful

This could be trimmed to:
https://www.furaffinity.net/view/47654361/

Note that the ?upload-successful parameter is useful for determining if the uploader is the artist or commissioner. However, this may present a privacy issue if they are posting to e621 under a deliberately different account name and not aware of the potentially identifying information in the source URL.

-

Lastly, Furaffinity post links may be formatted as either "view" or "full". The latter will look like this:
https://www.furaffinity.net/full/47654361/

General consensus is to use the "view" URL since logged-in settings will determine how the image is served, and "full" always serves a larger image, even if not desired. It should be safe to reformat it as:
https://www.furaffinity.net/view/47654361/

kemonophonic said:
Can we also remove the word mobile from Twitter links and replace them with www?

topic #34356 covers this separately. Twitter links default to no hostname prefix (and redirect if you include it), so "mobile." can be trimmed without replacement.

Oh, I missed this thread, but spotted similar issues with lots of old e621 sources, some overlapping with the ones in here, and some different ones!

I made a thread over here with all my stats, and links to my code finding the errors and proposing fixes, and stuff: https://e621.net/forum_topics/34730

  • 1