Greasy Fork

来自缓存

Greasy Fork is available in English.

小红书无水印解析下载提取

小红书高清无水印图片解析提取下载,如出错请及时更新,首次使用请在跳转的页面点击"Always allow domain"

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         小红书无水印解析下载提取
// @version      1.4
// @description  小红书高清无水印图片解析提取下载,如出错请及时更新,首次使用请在跳转的页面点击"Always allow domain"
// @author       zstatic
// @icon         https://s4.zstatic.net/images/2024/02/27-dee8a1b54cbf770ab8a3d0d8ed96931a.ico
// @match        https://www.xiaohongshu.com/*
// @grant        GM_xmlhttpRequest
// @license      MIT
// @namespace http://greasyfork.icu/users/1258677
// ==/UserScript==

(function() {
    'use strict';

    function extractHash(content) {
        var startIndex = content.lastIndexOf("/") + 1;
        var endIndex = content.indexOf("!");
        return content.substring(startIndex, endIndex);
    }

    function downloadImage(hash) {
        var imageUrl = "https://i2.zstatic.net/" + hash + "?imageView2/2/w/format/png";
        GM_xmlhttpRequest({
            method: "GET",
            url: imageUrl,
            responseType: "blob",
            onload: function(response) {
                var blob = response.response;
                var a = document.createElement("a");
                var url = window.URL.createObjectURL(blob);
                a.href = url;
                a.download = "image.png";
                a.click();
                window.URL.revokeObjectURL(url);
            }
        });
    }

    function extractAndDownloadImages() {
        var metaTags = document.querySelectorAll('meta[name="og:image"]');
        if (metaTags.length > 0) {
            var downloadedHashes = [];
            metaTags.forEach(function(metaTag) {
                var content = metaTag.content;
                var hash = extractHash(content);
                if (!downloadedHashes.includes(hash)) {
                    downloadImage(hash);
                    downloadedHashes.push(hash);
                }
            });
        }
    }

    window.addEventListener("load", function() {
        extractAndDownloadImages();
    });
})();