移除小红书首页的个性化推送

当访问小红书首页时自动移除个性化推送

当前为 2025-04-29 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Remove Xiaohongshu Recommended Feeds
// @name:zh-CN   移除小红书首页的个性化推送
// @description  Automatically removes the exploreFeeds element from Xiaohongshu pages
// @description:zh-CN  当访问小红书首页时自动移除个性化推送
// @namespace    https://github.com/Konano
// @version      1.1.0.20250429
// @author       Konano
// @homepageURL  https://github.com/Konano/greasyfork-script
// @match        https://www.xiaohongshu.com/*
// @icon         https://www.xiaohongshu.com/favicon.ico
// @license      MIT
// @grant        none
// @run-at       document-start
// ==/UserScript==

(function() {
    'use strict';

    // Execute after page load
    window.addEventListener('load', function() {
        removeElements();
    });

    // Also check and remove elements when DOM changes
    const observer = new MutationObserver(function() {
        removeElements();
    });

    observer.observe(document.documentElement, {
        childList: true,
        subtree: true
    });

    function removeElements() {
        // Remove exploreFeeds element
        const exploreElement = document.getElementById('exploreFeeds');
        if (exploreElement && !exploreElement.dataset.removed) {
            exploreElement.remove();
            console.log('Xiaohongshu exploreFeeds element has been removed');
            exploreElement.dataset.removed = 'true';
        }
        
        // Remove elements with IDs starting with "homefeed."
        const homefeedElements = document.querySelectorAll('[id^="homefeed."]');
        homefeedElements.forEach(element => {
            if (!element.dataset.removed) {
                element.remove();
                console.log('Xiaohongshu element with ID starting with "homefeed." has been removed');
                element.dataset.removed = 'true';
            }
        });
        
        // Remove element with ID "homefeed_recommend"
        const recommendElement = document.getElementById('homefeed_recommend');
        if (recommendElement && !recommendElement.dataset.removed) {
            recommendElement.remove();
            console.log('Xiaohongshu homefeed_recommend element has been removed');
            recommendElement.dataset.removed = 'true';
        }
    }
})();