Last active
July 3, 2025 21:20
-
-
Save lumynou5/863b900b16eae7059ebf14563057ff6b to your computer and use it in GitHub Desktop.
Hide AI-generated illustrations from Pixiv.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Pixiv Dis-AI | |
// @version 0.3.4 | |
// @description Hide AI-generated illustrations from Pixiv. | |
// @author Lumynous | |
// @license MIT | |
// @match https://www.pixiv.net/* | |
// @noframes | |
// @grant GM.getValue | |
// @grant GM.setValue | |
// @downloadURL https://gist.github.com/lumynou5/863b900b16eae7059ebf14563057ff6b/raw/pixiv-dis-ai.user.js | |
// ==/UserScript== | |
const AI_USER_LIST_URL = 'https://gist.githubusercontent.com/lumynou5/863b900b16eae7059ebf14563057ff6b/raw/users'; | |
const AI_ILLUST_OPACITY = '0.2'; | |
// Sorted by usage (descend) for performance. | |
const aiTags = [ | |
'AIイラスト', | |
'AI', | |
'AI生成', | |
'AIart', | |
'AI-generated', | |
]; | |
const aiUsers = await (async function () { | |
let arr; | |
do { | |
const remoteMt = await fetch(AI_USER_LIST_URL, {headers: {'Range': 'bytes=0-21'}}) | |
.then((res) => res.text()) | |
.then((text) => Date.parse(text.split('\n')[0])) | |
.catch(() => 0); | |
const localMt = await GM.getValue('mt', 0); | |
if (remoteMt <= localMt || isNaN(remoteMt)) | |
break; | |
arr = await fetch(AI_USER_LIST_URL, {headers: {'Range': 'bytes=23-'}}) | |
.then((res) => res.text()) | |
.then((text) => text.split('\n')) | |
.catch(() => null) | |
if (!arr) | |
break; | |
GM.setValue('mt', remoteMt); | |
GM.setValue('user_list', JSON.stringify(arr)); | |
} while (0); | |
arr ??= JSON.parse(await GM.getValue('user_list', '[]')); | |
return arr.reduce((acc, val) => (acc[val] = true) && acc, {}); | |
})(); | |
const watchElm = (function () { | |
const observer = new MutationObserver(observerCallback); | |
observer.observe(document, {childList: true, subtree: true}); | |
const callbacks = new Set(); | |
function observerCallback(mutations) { | |
for (const {callback, selector} of callbacks) { | |
for (const mutation of mutations) { | |
for (const node of mutation.addedNodes) { | |
if (node.nodeType !== Node.ELEMENT_NODE) | |
continue; | |
if (node.matches(selector)) | |
callback(node); | |
for (const x of node.querySelectorAll(selector)) | |
callback(x); | |
} | |
} | |
} | |
} | |
return (selector, callback) => { | |
for (const elm of document.querySelectorAll(selector)) { | |
callback(elm); | |
} | |
callbacks.add({callback, selector}); | |
}; | |
})(); | |
// The selectors are: | |
// - Top recommendation on the home page. | |
// - Searching. | |
// - Tag recommendation, related artworks, and user artworks. | |
watchElm('.sc-1864c03c-0, .sc-98699d11-2, .sc-bf8cea3f-2', (elm) => { | |
// [1] is __reactProps. The property name has a random suffix. | |
const info = Object.values(elm)[1].children.props.thumbnail; | |
if (!info) | |
return; | |
if (info.aiType === 2 || info.tags.some((tag) => aiTags.includes(tag)) || info.userId in aiUsers) { | |
elm.style.opacity = AI_ILLUST_OPACITY; | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2025-07-04T05:19+08:00 | |
3328617 | |
8986455 | |
9013106 | |
15325426 | |
16315304 | |
18036457 | |
18357648 | |
18510872 | |
20468285 | |
20557152 | |
24033806 | |
26157153 | |
27004418 | |
27368325 | |
35992413 | |
36112955 | |
37168136 | |
53998244 | |
60497488 | |
61598251 | |
76316220 | |
79152651 | |
87042098 | |
87429561 | |
88267790 | |
89803149 | |
90351205 | |
91325601 | |
95485582 | |
96107480 | |
99610792 | |
101303554 | |
101555203 | |
101746026 | |
102831195 | |
103438231 | |
103438492 | |
104935838 | |
105518914 | |
106188743 | |
106784447 | |
108388963 | |
109080877 | |
109337851 | |
109676302 | |
109987538 | |
110887422 | |
111638616 | |
111779616 | |
111781384 | |
112591781 | |
113293180 | |
113394629 | |
113574601 | |
114267011 | |
114323636 | |
114695282 | |
115507089 | |
116039247 | |
116040274 | |
116342680 | |
116685552 | |
117735677 | |
131566898 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Pixiv Dis-AI [en]
Hide AI-generated illustrations from Pixiv.
Besides the AI type set by the author, this userscript also respects community-added AI illustration tags, such as
AIイラスト
, to avoid the case that the author didn't mark their illustrations as AI-generated. This can't be without the community, so if you find something AI-generated without the tags, add it, and everyone appreciates that.However, sometimes no more tags can be added because of the limit of tags, and still seeing AI-generated illustrations that are too new to be tagged is annoying. Therefore, this userscript experimentally maintains a list of AI users. If you find an user using AI that is not in the list, you may report by leaving a comment here.
Pixiv 反 AI [zh-TW]
隱藏 Pixiv 上 AI 生成的作品。
此使用者腳本除了作者自己設定的 AI 類型,也認得社群新增的 AI 插畫標籤,如
AIイラスト
等,來避免作者不正確設定作品類型的情況。這一切都依賴社群的互助,因此如果你發現有 AI 生成的作品上沒有標籤,加上它。不過,有時候會因達到上限而沒辦法加上更多標籤,而且瀏覽時仍會看到新上傳、還沒有人來得及加上標籤的 AI 生成作品很煩。所以我實驗地維護了一份 AI 使用者的名單。若你找到不在名單上的 AI 使用者,可以透過留言回報。
Pixiv Dis-AI [ja]
Pixiv で AI 生成イラスト非表示にします。
このユーザースクリプトは、作者が設定した AI タイプに加えて、
AIイラスト
等コミュニティが追加したタグも認識し、作者がイラストのタイプを誤って設定した場合でも動作します。これは全てコミュニティの協力なしには実現できません。タグが付いていない AI イラストを見つけた場合は追加してください。ただし、タグの上限に達してタグを追加できない場合があり、誰もタグを追加していない AI 生成作品が表示されるのは煩わしいです。そこで、実験的に AI ユーザーリストを維持しています。リストに載っていない AI ユーザーを見つけた場合は、コメントで報告してください。