this post was submitted on 24 Aug 2023
324 points (99.1% liked)

Firefox

17865 readers
8 users here now

A place to discuss the news and latest developments on the open-source browser Firefox

founded 4 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] Crul@lemm.ee 1 points 1 year ago* (last edited 1 year ago) (1 children)

Got it, thanks for the patience :)

It makes the job easier than reverse searching image with Yandex (which is the best method I use).

Regarding reverse image search, this is the bookmarklet I use to lauch 5 different searches at once. On firefox you can set a keyword so I just type rev on the navbar on a tab with an image.

If the page has more than 1 images, it tries to print a number on each one so you can specify which one you want to search... but that feature doesn't work very well. Removing that, the script would be much more simpler.

pretty-print reverse image searches bookmarklet

(function() {
    var url;
    var args = '%s';
    var imgs = document.getElementsByTagName("img");
    var imgIdx = undefined;
    if (imgs.length == 0) return;
    if (imgs.length > 1) {
        if (args.length > 1) imgIdx = parseInt(args[1]);
        if (imgIdx === undefined || isNaN(imgIdx) || imgIdx < 1 || imgIdx > imgs.length) {
            numberImgs();
            imgIdx = parseInt(prompt(`There are ${imgs.length} images, select index:`, 1));
        }
        if (isNaN(imgIdx) || imgIdx < 1 || imgIdx > imgs.length) return;
        url = imgs[imgIdx - 1].src;
    } else {
        url = imgs[0].src;
    }
    if (!url) return;
    url = encodeURIComponent(url);
    window.open("https://saucenao.com/search.php?url=" + url);
    window.open("https://lens.google.com/uploadbyurl?url=" + url);
    window.open("https://www.bing.com/images/searchbyimage?cbir=sbi&imgurl=" + url);
    window.open("https://www.tineye.com/search?url=" + url);
    window.open("https://yandex.com/images/search?rpt=imageview&url=" + url);

    function numberImgs() {
        var imgs = document.getElementsByTagName("img");
        for (var img = 0; img < imgs.length; img++) {
            var parent = imgs[img].parentElement;
            if (!parent) continue;
            var numberDiv = document.createElement("div");
            numberDiv.innerHTML = 1 + img;
            numberDiv.className = "tmpImgNumberDiv";
            numberDiv.style.position = "absolute";
            numberDiv.style.padding = "2px 9px 2px 6px";
            numberDiv.style.background = "#f00";
            numberDiv.style.color = "#fff";
            numberDiv.style.zIndex = "9999";
            numberDiv.style.lineHeight = "normal";
            parent.prepend(numberDiv);
        }
        setTimeout(function() {
            var imgNumbers = document.getElementsByClassName("tmpImgNumberDiv");
            var idx = imgNumbers.length - 1;
            while (idx >= 0) {
                imgNumbers[idx].remove();
                idx--;
            }
        }, 5000);
    }
})();

 

One-liner:

javascript:(function() {var url;var args = '%s';var imgs = document.getElementsByTagName("img");var imgIdx = undefined;if (imgs.length == 0) return;if (imgs.length > 1) {if (args.length > 1) imgIdx = parseInt(args[1]);if (imgIdx === undefined || isNaN(imgIdx) || imgIdx < 1 || imgIdx > imgs.length) {numberImgs();imgIdx = parseInt(prompt(`There are ${imgs.length} images, select index:`, 1));}if (isNaN(imgIdx) || imgIdx < 1 || imgIdx > imgs.length) return;url = imgs[imgIdx - 1].src;} else {url = imgs[0].src;}if (!url) return;url = encodeURIComponent(url);window.open("https://saucenao.com/search.php?url=" + url);window.open("https://lens.google.com/uploadbyurl?url=" + url);window.open("https://www.bing.com/images/searchbyimage?cbir=sbi&imgurl=" + url);window.open("https://www.tineye.com/search?url=" + url);window.open("https://yandex.com/images/search?rpt=imageview&url=" + url);function numberImgs() {var imgs = document.getElementsByTagName("img");for (var img = 0; img < imgs.length; img++) {var parent = imgs[img].parentElement;if (!parent) continue;var numberDiv = document.createElement("div");numberDiv.innerHTML = 1 + img;numberDiv.className = "tmpImgNumberDiv";numberDiv.style.position = "absolute";numberDiv.style.padding = "2px 9px 2px 6px";numberDiv.style.background = "#f00";numberDiv.style.color = "#fff";numberDiv.style.zIndex = "9999";numberDiv.style.lineHeight = "normal";parent.prepend(numberDiv);}setTimeout(function() {var imgNumbers = document.getElementsByClassName("tmpImgNumberDiv");var idx = imgNumbers.length - 1;while (idx >= 0) {imgNumbers[idx].remove();idx--;}}, 5000);}})();

The 5 searches it launches are (replacing XXXX with the image URL):

  • Google: https://lens.google.com/uploadbyurl?url=XXXX
  • Bing: https://www.bing.com/images/searchbyimage?cbir=sbi&imgurl=XXXX
  • TinEye: https://www.tineye.com/search?url=XXXX
  • Yandex: https://yandex.com/images/search?rpt=imageview&url=XXXX
  • SauceNAO: https://saucenao.com/search.php?url=XXXX