Open SaltSouls opened 8 months ago
I did something similar using this other extension https://addons.mozilla.org/en-US/firefox/addon/man-in-the-middle/ You will need to create 5 rules like this
var bannedTags = ["AI-generated", "AIイラスト"];
var resp = JSON.parse(responseBody);
var urlToChange = []; Object.keys(resp.body.illusts).forEach(key => { if (resp.body.illusts[key].aiType == 2){ urlToChange.push(resp.body.illusts[key].url); }else if (bannedTags.some(i => resp.body.illusts[key].tags.includes(i))){ urlToChange.push(resp.body.illusts[key].url); } });
urlToChange.forEach(function(url){ responseBody = responseBody.replace(url.replace(/\//g, '\\/'), 'https://dataconomy.com/wp-content/uploads/2022/12/No-to-AI-generated-images-ArtStation-protest-explained-1.jpg'); });
return responseBody
/https\:\/\/www.pixiv.net\/ajax\/user\/\d+\/profile\/top.*/
- AI Shit artworks page (pixiv)
```var bannedTags = ["AI-generated", "AIイラスト"];
var resp = JSON.parse(responseBody);
var urlToChange = [];
Object.keys(resp.body.works).forEach(key => {
if (resp.body.works[key].aiType == 2){
urlToChange.push(resp.body.works[key].url);
} else if (bannedTags.some(i => resp.body.works[key].tags.includes(i))){
urlToChange.push(resp.body.works[key].url);
}
});
urlToChange.forEach(function(url){
responseBody = responseBody.replace(url.replace(/\//g, '\\\/'), 'https://dataconomy.com/wp-content/uploads/2022/12/No-to-AI-generated-images-ArtStation-protest-explained-1.jpg');
});
return responseBody
/https\:\/\/www\.pixiv\.net\/ajax\/user\/\d+\/profile\/illusts.*/
/https\:\/\/www\.pixiv\.net\/ajax\/user\/\d+\/illustmanga\/tag/
var bannedTags = ["AI-generated", "AIイラスト"];
var resp = JSON.parse(responseBody);
var urlToChange = []; Object.keys(resp.body.illustManga.data).forEach(key => { if (resp.body.illustManga.data[key].aiType == 2){ urlToChange.push(resp.body.illustManga.data[key].url); } else if (bannedTags.some(i => resp.body.illustManga.data[key].tags.includes(i))){ urlToChange.push(resp.body.illustManga.data[key].url); } });
urlToChange.forEach(function(url){ responseBody = responseBody.replace(url.replace(/\//g, '\\/'), 'https://dataconomy.com/wp-content/uploads/2022/12/No-to-AI-generated-images-ArtStation-protest-explained-1.jpg'); });
return responseBody
/https\:\/\/www.pixiv.net\/ajax\/search\/top\/./ /https\:\/\/www.pixiv.net\/ajax\/search\/artworks\/./
- AI Shit Follow suggestion (pixiv)
var bannedTags = ["AI-generated", "AIイラスト"];
var resp = JSON.parse(responseBody);
var urlToChange = []; Object.keys(resp.body.thumbnails.illust).forEach(key => { if (resp.body.thumbnails.illust[key].aiType == 2){ urlToChange.push(resp.body.thumbnails.illust[key].url); } else if (bannedTags.some(i => resp.body.thumbnails.illust[key].tags.includes(i))){ urlToChange.push(resp.body.thumbnails.illust[key].url); } });
urlToChange.forEach(function(url){ responseBody = responseBody.replaceAll(url.replace(/\//g, '\\/'), 'https://dataconomy.com/wp-content/uploads/2022/12/No-to-AI-generated-images-ArtStation-protest-explained-1.jpg'); });
return responseBody
/https\:\/\/www.pixiv.net\/ajax\/user\/\d+\/recommends.*/
- AI Shit homepage auth highlight (pixiv)
var bannedTags = ["AI-generated", "AIイラスト"];
var resp = JSON.parse(responseBody);
var urlToChange = []; Object.keys(resp.body.pickup).forEach(key => { if (resp.body.pickup[key].aiType == 2){ urlToChange.push(resp.body.pickup[key].url); }else if (bannedTags.some(i => resp.body.pickup[key].tags.includes(i))){ urlToChange.push(resp.body.pickup[key].url); } });
urlToChange.forEach(function(url){ responseBody = responseBody.replace(url.replace(/\//g, '\\/'), 'https://dataconomy.com/wp-content/uploads/2022/12/No-to-AI-generated-images-ArtStation-protest-explained-1.jpg'); });
return responseBody
/https\:\/\/www.pixiv.net\/ajax\/user\/\d+\/profile\/all.*/
Hope it helps
I'm not sure if this is possible, since i'm pretty sure uBO only has access to CSS selectors, not to the actual page data like what Google or DuckDuckGo has. Using something like -intext:"AI-generated"
in your search query (for Google Search) actually crawls for webpages without the Pixiv tag AI-generated
. Unfortunately I think this isn't possible with plain CSS selectors, as there is not enough information to do that with since information like tags and descriptions are usually truncated.
Oh, I just realized that you mean on the actual pixiv site, not on search engines (or did you mean that?). Anyways, for the actual pixiv site, I dunno. Haven't looked into it yet. Will see tho!
Yeah I mean on the pixiv site itself, it has a full tag for AI-Generated images and the like. I don't know if uBlock is able to take advantage of it, but I figure if it could, then it would be nice to filter out all the slop when searching for images there.
So I've looked into this a bit, and the closest thing to the tags pixiv has is the alt text, which can house tags. Problem is, is that alt text is user-specified; it isn't actually tied to the tags system at all. The tags do not appear in html (when searching for images, eg. scrolling homepage, search bar queries, etc), so uBlock can't take advantage of them. Pretty unfortunate.
I will say however that Pixiv does have an AI-generated content toggle in Display settings
in your Pixiv settings, which would hide any AI content that is tagged with AI-generated
. I could be wrong about this, but I believe the AI-generated content toggle is off by default, meaning that all AI slop should be hidden.
I did something similar...
I wrote a possible solution using another plugin, firefox only, it was hidden up until now as my account was being limited, so check the second comment https://github.com/laylavish/uBlockOrigin-HUGE-AI-Blocklist/issues/10#issuecomment-2132380083
Not sure how hard this would be, but Pixiv has an AI tag that this may be able to take advantage of in order to block said images/creators from showing that post AI images.