Bionus / imgbrd-grabber

Very customizable imageboard/booru downloader with powerful filenaming features.
https://www.bionus.org/imgbrd-grabber/
Apache License 2.0
2.54k stars 216 forks source link

Wiki: The Idolm@ster links in the wiki shown as [email protected] and clicking them doesn't show up properly. #1362

Closed SemifKnight closed 6 years ago

SemifKnight commented 6 years ago

Bug description References to The Idolm@ster show up in the wiki box as [email protected].

Steps to reproduce

  1. Search an idolmaster character, for example "koshimizu_sachiko"
  2. It shows up like this: grabber wiki idolmaster

*Clicking it goes to a nonexistent tag instead of the proper idolmaster_cinderella_girls tag: grabber wiki - not idolmaster tag

*Update: It seems that the idolm%40ster bug only appears in some wiki pages. In 3 other character pages I tested, they all went to the proper "idolmaster_cinderella_girls" tag in a new tab, despite appearing as "[email protected]" in the wiki box.

Expected behavior The wiki box should display "idolmaster" when it is being referred to in context, instead of showing up as [email protected], although the problem might be coming from Danbooru.

System information

(Oops, accidentally submitted early, sorry. Also, new issue forms :o )

Bionus commented 6 years ago

Well, it seems Danbooru is behind CloudFlare, and that they have enabled email protection, to prevent bots from reading emails addresses on the page.

Therefore, if one were to look at the wiki page in question, one could see in the source code that idolm@ster was recognized as an email and "encrypted":

<p>Koshimizu Sachiko (輿水 幸子) is a character from <a class="dtext-link dtext-wiki-link" href="/wiki_pages/show_or_new?title=idolm%40ster_cinderella_girls"><span class="__cf_email__" data-cfemail="0148454e4d4c4152554453">[email&#160;protected]</span> Cinderella Girls</a>.</p>

Given decoding a CloudFlare-encrypted is trivial, I'll see to automatically do so.

For reference, the JavaScript implementation of the decoding:

function decodeEmail(a) {
    s = '';
    r = parseInt(a.substr(0, 2), 16);
    for (j = 2; a.length - j; j += 2) {
        c = parseInt(a.substr(j, 2), 16) ^ r;
        s += String.fromCharCode(c);
    }
    return s;
}
Bionus commented 6 years ago

As for the link that goes to an invalid tag, there's little I can do.

The link is simply wrong on Danbooru's end. If you click it, even on their own wiki, you'll get a "wiki not found", because they put a @/%40 instead of a basic a in the link.