// ==UserScript== // @name 蓝奏云自动点击下载,直接下载apk文件,记住分享密码自动填写 // @version 3.4 // @description 自动点击下载,下载蓝奏云apk文件,记住蓝奏云分享密码自动填写 // @author ChatGPT // @include *.lanosso.com/* // @include *.lanzn.com/* // @include *.lanzog.com/* // @include *.lanpw.com/* // @include *.lanpv.com/* // @include *.lanzv.com/* // @include *://*.lanz*.com/* // @include *://lanz*.com/* // @run-at document-end // @grant none // @namespace https://greasyfork.org/users/452911 // @downloadURL none // ==/UserScript== //自动下载 // 点击所有 a.appa 元素 document.querySelectorAll('a.appa').forEach(link => { link.click(); console.log('已点击 a.appa 元素:', link); }); // 点击所有 [href='javascript:filego();'] 元素 document.querySelectorAll('a[href="javascript:filego();"]').forEach(link => { link.click(); console.log('已点击 filego 元素:', link); }); // 选择要监视的目标元素 const targetNode = document.body; // 配置观察器的选项(监视子节点变动) const config = { childList: true, subtree: true }; // 创建一个观察器实例并指定回调函数 const observer = new MutationObserver(function(mutationsList) { for(const mutation of mutationsList) { if (mutation.type === 'childList') { mutation.addedNodes.forEach(node => { if (node.tagName && node.tagName.toLowerCase() === 'a') { // 查找具有 onclick='m_load();' 属性的父元素,并在该父元素中查找子元素 进行点击 document.querySelector("[onclick='m_load();'] > a").click(); } }); } } }); // 通过观察器实例与目标节点绑定 observer.observe(targetNode, config); function extractAndNavigateURL() { // 获取整个页面的 HTML 源码,包括 script 标签中的内容 var htmlSource = document.documentElement.innerHTML; // 使用正则表达式匹配并提取 vkjxld 和 hyggid 变量的值 var vkjxldMatch = htmlSource.match(/\nvar vkjxld\s*=\s*['"]([^'"]+)['"];/); var hyggidMatch = htmlSource.match(/var hyggid\s*=\s*['"]([^'"]+)['"];/); // 确保匹配并提取成功 if (vkjxldMatch && hyggidMatch) { // 分别获取匹配到的值 var vkjxldValue = vkjxldMatch[1]; var hyggidValue = hyggidMatch[1]; // 拼接得到完整 URL var completeURL = vkjxldValue + hyggidValue; // 在当前标签页打开拼接好的 URL window.location.href = completeURL; } else { (function() { // 获取整个页面的 HTML 源码,包括 script 标签中的内容 var htmlSource = document.documentElement.innerHTML; // 使用正则表达式匹配并提取 link 变量的值 var urlptMatch = htmlSource.match(/var urlpt\s*=\s*['"]([^'"]+)['"];/); var linkMatch = htmlSource.match(/var link\s*=\s*['"]([^'"]+)['"];/); if (urlptMatch && linkMatch) { // 获取当前页面的域名,包括协议部分 let urlptValue = urlptMatch[1]; if(urlptValue === '/' ) urlptValue = window.location.origin; // 获取匹配到的 link 变量的值 var linkValue = linkMatch[1]; // 拼接当前域名和 link 变量的值 var completeURL = urlptValue + '/' + linkValue; // 在当前标签页打开拼接好的 URL window.location.href = completeURL; } else { } })(); } } extractAndNavigateURL(); //下载apk文件 // 检查是否包含指定文本 function checkTextAndRedirect() { // 待检查的文本 var textToCheck = "非会员"; // 用于检查页面中是否存在指定文字的代码 var bodyText = document.body.innerText || document.body.textContent; var textFound = bodyText.indexOf(textToCheck) > -1; // 如果找到文本,则替换网址 if (textFound) { var currentUrl = window.location.href; var newUrl = currentUrl.replace(".com/", ".com/tp/"); // 重新加载替换后的网址 window.location.href = newUrl; } } // 调用函数进行检查和重定向 checkTextAndRedirect(); //记住密码 (function() { 'use strict'; function init() { retrieveAndFill(); monitorChanges(); } function retrieveAndFill() { document.querySelectorAll('input[type="text"], textarea').forEach(function(element) { const id = getElementIdentifier(element); const storedValue = localStorage.getItem(id); if (storedValue) { element.value = storedValue; } }); } function monitorChanges() { document.querySelectorAll('input[type="text"], textarea').forEach(function(element) { element.removeEventListener('input', handleInputChange); // 防止重复监听 element.addEventListener('input', handleInputChange); }); } function handleInputChange(event) { const element = event.target; const id = getElementIdentifier(element); localStorage.setItem(id, element.value); } function getElementIdentifier(element) { // 使用页面URL、元素的name、id或类名的组合作为唯一标识符 let identifier = window.location.hostname + window.location.pathname; identifier += ':' + (element.name || element.id || element.classList[0] || getXPathForElement(element)); return identifier; } function getXPathForElement(element) { const paths = []; for (; element && element.nodeType === Node.ELEMENT_NODE; element = element.parentNode) { let index = 0; let hasFollowingSiblings = false; for (let sibling = element.previousSibling; sibling; sibling = sibling.previousSibling) { if (sibling.nodeType === Node.DOCUMENT_TYPE_NODE) continue; if (sibling.nodeName === element.nodeName) ++index; } for (let sibling = element.nextSibling; sibling && !hasFollowingSiblings; sibling = sibling.nextSibling) { if (sibling.nodeName === element.nodeName) hasFollowingSiblings = true; } const tagName = element.nodeName.toLowerCase(); const pathIndex = (index || hasFollowingSiblings ? "[" + (index + 1) + "]" : ""); paths.splice(0, 0, tagName + pathIndex); } return paths.length ? "/" + paths.join("/") : null; } // 监听DOM变化来支持动态加载的内容 const observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { if (mutation.addedNodes.length) { init(); // 如果检测到新增节点,则重新初始化 } }); }); observer.observe(document.body, { childList: true, subtree: true }); init(); // 初始执行 })();