🎉 欢迎访问GreasyFork.Org 镜像站!本镜像站由公众号【爱吃馍】搭建,用于分享脚本。联系邮箱📮

Greasy fork 爱吃馍镜像

Greasy Fork is available in English.

Scribd & SlideShare Viewer/Downloader

View or download from Scribd and SlideShare without an account

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

You will need to install an extension such as Tampermonkey to install this script.

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name        Scribd & SlideShare Viewer/Downloader
// @namespace   0b9
// @match       *://www.scribd.com/*
// @match       *://www.slideshare.net/slideshow/*
// @grant       none
// @version     1.1
// @author      0b9
// @description View or download from Scribd and SlideShare without an account
// @license     MIT
// ==/UserScript==

(function () {
    'use strict';

    const currentUrl = window.location.href;

    // ===== Scribd =====
    if (currentUrl.includes('scribd.com')) {
        sessionStorage.setItem('originalUrl', currentUrl);
        let originalUrl = null;

        function redirectToEmbed() {
            const currentUrl = window.location.href;
            sessionStorage.setItem('originalUrl', currentUrl);
            const regex = /https:\/\/www\.scribd\.com\/[^/]+\/([^/]+)\/[^/]+/;
            const match = currentUrl.match(regex);

            if (match) {
                const newUrl = `https://www.scribd.com/embeds/${match[1]}/content`;
                window.location.href = newUrl;
            } else {
                alert("Error: No match");
            }
        }

        function downloadContent() {
            const contentElements = document.querySelectorAll('.text_layer .a');
            let content = '';
            contentElements.forEach(element => {
                content += element.textContent + '\n';
            });

            const blob = new Blob([content], { type: 'text/plain' });
            const url = URL.createObjectURL(blob);
            const a = document.createElement('a');
            a.href = url;
            a.download = 'scribd_content.txt';
            document.body.appendChild(a);
            a.click();
            document.body.removeChild(a);
            URL.revokeObjectURL(url);
        }

        function downloadContentAsPDF() {
            const savedUrl = sessionStorage.getItem('originalUrl');
            if (!savedUrl) {
                alert('Error: Click the "View Full" button and try again');
                return;
            }

            const regex = /https:\/\/www\.scribd\.com\/(?:document|presentation)\/(\d+)\/([^\/?#]+)/;
            const match = savedUrl.match(regex);

            if (match) {
                const part1 = match[1];
                const part2 = match[2];
                const urls = [
                    `https://compress-pdf.vietdreamhouse.com/?fileurl=https://scribd.downloader.tips/pdownload/${part1}/${part2}&title=${part2}`,
                    `https://compress.tacz.info/?fileurl=https://scribd.vpdfs.com/pdownload/${part1}/${part2}&title=${part2}`
                ];
                const randomUrl = urls[Math.floor(Math.random() * urls.length)];
                window.location.href = randomUrl;
            } else {
                alert('Error: Invalid URL');
            }
        }

        function createButton(text, top, bgColor, onClick) {
            const btn = document.createElement('button');
            btn.textContent = text;
            btn.style.position = 'fixed';
            btn.style.top = top;
            btn.style.right = '10px';
            btn.style.zIndex = '1000';
            btn.style.padding = '10px';
            btn.style.backgroundColor = bgColor;
            btn.style.color = 'white';
            btn.style.border = 'none';
            btn.style.borderRadius = '5px';
            btn.style.cursor = 'pointer';
            btn.addEventListener('click', onClick);
            document.body.appendChild(btn);
        }

        createButton('View Full', '10px', '#4CAF50', redirectToEmbed);
        createButton('Download TXT', '50px', '#007BFF', downloadContent);
        createButton('Download PDF', '90px', '#FF5733', downloadContentAsPDF);
    }

    // ===== SlideShare =====
    if (currentUrl.includes('slideshare.net/slideshow/')) {
        const match = currentUrl.match(/https:\/\/www\.slideshare\.net\/slideshow\/([^/]+)\/(\d+)/);
        let downloadUrl;

        if (match) {
            // If the URL follows the old ID-at-end pattern
            downloadUrl = `https://slideshare.vpdfs.com/download/slideshow/${match[1]}/${match[2]}`;
        } else {
            // Generic fallback - re-use the pathname
            const path = window.location.pathname.replace('/slideshow/', '');
            downloadUrl = `https://slideshare.vpdfs.com/download/slideshow/${path}`;
        }

        const downloadSlideShareBtn = document.createElement('button');
        downloadSlideShareBtn.textContent = 'Download PDF';
        downloadSlideShareBtn.style.position = 'fixed';
        downloadSlideShareBtn.style.top = '10px';
        downloadSlideShareBtn.style.right = '10px';
        downloadSlideShareBtn.style.zIndex = '1000';
        downloadSlideShareBtn.style.padding = '10px';
        downloadSlideShareBtn.style.backgroundColor = '#6f42c1';
        downloadSlideShareBtn.style.color = 'white';
        downloadSlideShareBtn.style.border = 'none';
        downloadSlideShareBtn.style.borderRadius = '5px';
        downloadSlideShareBtn.style.cursor = 'pointer';

        downloadSlideShareBtn.addEventListener('click', () => {
            window.location.href = downloadUrl;
        });

        document.body.appendChild(downloadSlideShareBtn);
    }

})();