吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 20268|回复: 171
收起左侧

[Windows] 求字体网下载器

    [复制链接]
头像被屏蔽
木小果 发表于 2022-1-27 16:12
提示: 作者被禁止或删除 内容自动屏蔽

本帖被以下淘专辑推荐:

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

feitaj 发表于 2022-1-29 17:48
写了个脚本,发现应该是限制IP地址的,,可以复制进入油猴中测试下
[JavaScript] 纯文本查看 复制代码
001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
033
034
035
036
037
038
039
040
041
042
043
044
045
046
047
048
049
050
051
052
053
054
055
056
057
058
059
060
061
062
063
064
065
066
067
068
069
070
071
072
073
074
075
076
077
078
079
080
081
082
083
084
085
086
087
088
089
090
091
092
093
094
095
096
097
098
099
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
// ==UserScript==
// [url=home.php?mod=space&uid=170990]@name[/url]         求字体网站 字体下载
// [url=home.php?mod=space&uid=467642]@namespace[/url]    **
// [url=home.php?mod=space&uid=1248337]@version[/url]      1.0.0
// @description  字体下载脚本
// [url=home.php?mod=space&uid=686208]@AuThor[/url]       Lolis
// [url=home.php?mod=space&uid=67665]@connect[/url]      www.qiuziti.com
// @connect      f01.lianty.cn
// [url=home.php?mod=space&uid=697773]@include[/url]      *://*.qiuziti.com/download*
// @require      https://cdn.jsdelivr.net/npm/js-cookie@3.0.1/dist/js.cookie.min.js
// [url=home.php?mod=space&uid=609072]@grant[/url]        GM_xmlhttpRequest
// @grant        GM_download
// ==/UserScript==
 
(function () {
    'use strict';
    console.log('%c ☘️: 脚本加载... ', 'font-size:16px;background-color:#4b5246;color:white;');
    const CONFIG = {
        FILE_NAME: '',
        POLLING_COUNT: 300 // 轮询次数
 
    };
    // 清空对应储存
    const clearStore = () => {
    console.log("%c 🏭: 清空储存 ", "font-size:16px;background-color:#700a6f;color:white;")
        localStorage.removeItem('QZT_TEST');
        Cookies.remove('Countdown');
    };
    // JSON格式转化
    const parse = (target) => {
        let o = null;
        try {
            if (typeof target === 'string') {
                o = JSON.parse(target);
            }
        } catch (error) {}
        return o;
    };
    // 下载流
    const doDownload = (blob) => {
        const fileName = CONFIG.FILE_NAME;
        const link = document.createElement('a');
        link.href = window.URL.createObjectURL(blob);
        link.download = fileName;
        link.click();
        window.URL.revokeObjectURL(link.href);
    };
    // 请求封装
    const request = (url) =>
        new Promise((resolve) => {
            GM_xmlhttpRequest({
                method: 'GET',
                url,
                responseType: 'blob',
                onload: async (res) => {
                    console.log('%c 📯: res ', 'font-size:16px;background-color:#9630d2;color:white;', res);
                    const text = await res.response.text();
                    const blob = parse(text);
                    if (blob?.error_code != 101 && res.status === 200) {
                        doDownload(res.response);
                        return resolve('break');
                    }
                    resolve(res);
                },
                onerror: async (error) => {
                    console.log(
                        '%c 📟: parse -> error ',
                        'font-size:16px;background-color:#818a1a;color:white;',
                        error
                    );
                    resolve(null);
                }
            });
        });
    // 新增DOM
    const renderDOM = () => {
        $('#ptDownload')
            .clone()
            .attr('id', 'ptDownload-clone')
            .css({ padding: '0 15px', width: 'auto' })
            .find('.s')
            .text('轮询下载')
            .parent()
            .css({ 'background-color': '#eadd45', color: '#fff' })
            .appendTo($('.download-handle'));
    };
    // 递归轮询
    let downloadCount = 0;
    const recursionDownloadRequest = async (url) => {
        // console.log('done');
        console.log(
            '%c 👩‍💼: recursionDownloadRequest -> downloadCount ',
            'font-size:16px;background-color:#18df40;color:black;',
            downloadCount
        );
        $('#ptDownload-clone').find('.s').text(`轮询中 (${downloadCount}/300)`);
        if (downloadCount >= CONFIG.POLLING_COUNT) {
            $('#ptDownload-clone').find('.s').text(`轮询下载`);
            downloadCount = 0;
            return;
        }
        try {
            const result = await request(url);
            if (result === 'break') {
                $('#ptDownload-clone').find('.s').text(`轮询下载`);
                downloadCount = 0;
                return;
            }
            // console.log(
            //  '%c 🐿️: recursionDownloadRequest -> result.responseText ',
            //  'font-size:16px;background-color:#a0f63d;color:black;',
            //  result.responseText
            // );
            setTimeout(() => {
                recursionDownloadRequest(url);
            }, 10);
        } catch (error) {
            console.log(
                '%c 🗻: recursionDownloadRequest -> error ',
                'font-size:16px;background-color:#1cd9a7;color:black;',
                error
            );
        }
        downloadCount++;
    };
 
    setTimeout(() => {
        // 渲染
        console.log('%c 🌽: 渲染 ', 'font-size:16px;background-color:#04b8c2;color:white;');
        renderDOM();
 
        // 点击沦陷下载
        $('#ptDownload-clone').click(function () {
            clearStore();
            const url = $(this).data('url');
            if (url) {
                const downloadUrl = HOST.DOWNLOAD + API.qztDownload + '?url=' + encodeURIComponent(url);
                CONFIG.FILE_NAME = url.split('/').pop();
                recursionDownloadRequest(downloadUrl);
            }
        });
    });
})();

免费评分

参与人数 3吾爱币 +3 热心值 +3 收起 理由
caisong + 1 + 1 脚本有错误
fazl + 1 + 1 优秀
a1554688500 + 1 + 1 用心讨论,共获提升!

查看全部评分

马老湿 发表于 2022-3-10 11:16
能下载,但是压缩包是空的,试了很多个都是这样
aini2008ha 发表于 2022-1-27 16:16
呵呵我笑了 发表于 2022-1-27 16:26
这网站也是,刷新100多次
sooboo 发表于 2022-1-27 16:51
大佬就是牛批,虽然我也不用
yaojiahong 发表于 2022-1-27 16:54
我的天,这都可以,佩服,大写的佩服
aysywy 发表于 2022-1-27 17:18
这可免的一直f5了,老是安到手软。
halou 发表于 2022-1-27 17:19
佩服,佩服!
王成 发表于 2022-1-27 17:32
居然还能这样操作,受教了感谢!
逆向学习 发表于 2022-1-27 17:51
膜拜一下,也可以写个油猴脚本使用
[JavaScript] 纯文本查看 复制代码
location.reload();
无限刷新
麦迪就是帅 发表于 2022-1-27 17:54
大佬 666
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2025-5-28 13:37

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表