本站单页下载快速生成下载信息的油猴子脚本

前端 潘老师 2年前 (2023-07-22) 317 ℃ (0) 扫码查看

为了方便本地集成多个网盘单页下载的功能,快速解析发布多网盘地址和下载资源的信息,写一个个油猴子脚本,目前只支持夸克网盘、百度网盘,后续有新网盘再新增。随时备用,以防丢失,脚本信息记录如下:

脚本1:


// ==UserScript==
// @name         博客资源下载解析
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://www.panziye.com/wp-admin/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=mfzy8.cn
// @grant        none
// @require http://libs.baidu.com/jquery/2.0.0/jquery.min.js
// ==/UserScript==
(function() {
    'use strict';

    // Your code here...
    $("#git_download_link").after('<button class="button" id="parseLink">解析</button>');
    $("#parseLink").click(
        function(event){
            event.preventDefault();
            var dps = $("#git_download_link").val();
            var downs = dps.split("\n");
            var kuake = "";
            var baidu = "";
            for(var i=0;i<downs.length;i++){
                var item = downs[i];
                if(item.includes("baidu.com")){
                    baidu = item;
                }else if(item.includes("quark.cn")){
                    kuake = item;
                }
            }
            //$("#git_download_size").val(cts[1]);
            var dname = dps.substring(dps.indexOf('「')+1, dps.indexOf('」'));
            $("#git_download_name").val(dname);
            var kkLink = kuake.split(":")[1];
            var baiduLink = baidu.split(" ")[1];
            $("#git_download_link").val(kkLink+"\n"+baiduLink);
        }
    );
})();

久坐提醒:

// ==UserScript==
// @name         每隔30分钟提醒运动喝水
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  每隔自定义时间间隔在右下角弹窗提醒运动喝水
// @author       You
// @match        https://hao.panziye.com
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // 自定义间隔时间(毫秒),30分钟 = 30 * 60 * 1000 毫秒
    const interval = 30 * 60 * 1000;

    // 提醒函数
    function showReminder() {
        const notification = new Notification('提醒', {
            body: '该运动喝水啦!',
            icon: 'https://example.com/your-icon.png', // 你可以替换成你自己的图标URL
            requireInteraction: true
        });

        // 为了确保在浏览器不支持Notification API时也有提醒,可以使用alert作为备用方案
        if (!("Notification" in window) || Notification.permission === "denied") {
            alert("该运动喝水啦!");
        } else {
            // 监听通知点击事件(可选)
            notification.onclick = function() {
                window.focus();
            };
        }
    }

    // 开始提醒间隔
    setInterval(showReminder, interval);

    // 如果希望立即显示一次提醒(可选),可以调用一次showReminder函数
    // showReminder();

})();

 

脚本2:

// ==UserScript==
// @name         城通网盘转短代码
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://home.ctfile.com/
// @icon         https://www.google.com/s2/favicons?sz=64&domain=ctfile.com
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Your code here...
    var myTarget = setInterval(function(){ parse() }, 2000);
    function parse(){
        var content = $("#link_area").val();
        var parsed = content.includes("[ctfile");
        if(!parsed){
            var contents = content.split(": ")
            var filename = contents[0];
            var link = contents[1].split(" ")[0].replace("\n",'');
            var size = '';
            // 根据名称获取大小
            $('.pull-left a').each(function(){
               if($(this).text()==filename) {
                   size = $(this).parent().parent().next().text();
                   return;
               }
            });
            $("#link_area").val(filename+";"+size+";"+link);
        }
    }
})();

只要将百度网盘分享地址和城通网盘分享地址粘贴到单页下载的内容处,点击解析按钮就可以将对应的信息填充完整。


版权声明:本站文章,如无说明,均为本站原创,转载请注明文章来源。如有侵权,请联系博主删除。
本文链接:https://www.panziye.com/front/6980.html
喜欢 (1)
请潘老师喝杯Coffee吧!】
分享 (0)
用户头像
发表我的评论
取消评论
表情 贴图 签到 代码

Hi,您需要填写昵称和邮箱!

  • 昵称【必填】
  • 邮箱【必填】
  • 网址【可选】