zabe40 / musicbrainz-userscripts

My userscripts for musicbrainz
3 stars 0 forks source link

Link to page instead of to image #8

Closed jesus2099 closed 6 months ago

jesus2099 commented 6 months ago

Now for Wikipedia Commons images, the page of the image is linked. I think it's nice.

For other types of image, it is directly the image that is linked (when you click on the sidebar image).

Would it be possible to link to the containing page? Maybe not possible in all cases?

Because we can always right click to obtain the image URL if we need it, anyway.

But we cannot find the page URL, which could be often interesting.

zabe40 commented 6 months ago

I definitely agree and I'd love to add something like this, but I don't think there's a way to reliably get the URL of the containing page. In general there's two different cases:

  1. the URL in the relationship points directly to an image file

In this case displaying the image is easy, but linking to the containing page is quite difficult. One idea could be to use a reverse image search service like Tineye or Google, but I don't think they have any idea of a "canonical" link to the image so you'd probably have to sort through multiple sites to get the one you wanted. Another idea could be to use a backlink search service, but it looks like most of those aren't free. Mayyyybe the userscript could crawl the domain for backlinks, but that seems way too slow for what should be a fast userscript.

  1. the URL in the relationship points to the containing page

Now linking the containing page is the easy part, but displaying the image is trickier. This is the case for commons.wikimedia.org URLs, and I have a special case to handle it. I don't think it would be too difficult to make it extensible with different modules for different websites, but first I think I'd want to have some data on which sites are most common as image/logo/poster URLs in the MB database. If you could do that that would be great, I definitely don't have space for the whole database on my laptop. Another idea for this case is to just give up and put the whole linked webpage in an iframe, but I think that would be a last resort.

The final piece to make this difficult is that the only ways to tell which case we're dealing with is to either have an list of special cases or just fetch the page. If you have any ideas for the first case, or can get me the data on the most common URLs with the second case, please let me know.

jesus2099 commented 6 months ago

Oh, OK! Now I see where the images come from. I didn't know (#9) images came from direct image URL relationships. I thought these relationships did not exist any more.

You can ignore this ticket, better not lose time trying to get page from image. 😁👍