// ==UserScript== // @name 电子课本pdf下载 // @namespace https://space.bilibili.com/314017356 // @version 1.7 // @description 从国家中小学智慧教育平台下载pdf课本 // @author 清遥 // @license CC BY-NC-SA // @match https://*.smartedu.cn/* // @match https://www.zxx.edu.cn/* // @icon https://basic.smartedu.cn/favicon.ico // @grant none // @compatible Chrome // @compatible Firefox // @compatible Edge // @compatible Safari // @run-at document-start // @downloadURL none // ==/UserScript== var currentUrl = window.location.href; //获取当前url let begin = currentUrl.indexOf("contentId=") + 10 //检测文件头位置 let end = currentUrl.indexOf("&catalogType=") //检测文件尾位置 let key = currentUrl.indexOf("=tchMaterial") + currentUrl.indexOf("elecedu") //检测该页面是否为电子课本 if (begin != 9 , end != -1 , key != -2){ //判断是否含有文件头尾及是否为电子课本 var newUrl=(currentUrl.slice(begin, end)); //提取文件名 window.location.assign("https://r1-ndr.ykt.cbern.com.cn/edu_product/esp/assets_document/"+newUrl+".pkg/pdf.pdf"); //打开文件 }else{}