您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
比如加上小区的建筑年代
当前为
// ==UserScript== // @name 链家租房列表增加一些信息 // @namespace https://gf.qytechs.cn/zh-CN/users/177458-bd777 // @version 0.2 // @description 比如加上小区的建筑年代 // @author windeng // @match https://gz.lianjia.com/zufang/* // @icon https://www.google.com/s2/favicons?domain=lianjia.com // @require https://gf.qytechs.cn/scripts/433586-simpletools/code/SimpleTools.js?version=977251 // @grant GM_xmlhttpRequest // ==/UserScript== var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver async function GetXiaoquPage(xiaoquId) { return Get(`https://gz.lianjia.com/xiaoqu/${xiaoquId}`) } async function GetXiaoquInfo(xiaoquId) { let resp = await GetXiaoquPage(xiaoquId) // console.log(resp) let el = document.createElement('html') el.innerHTML = resp // console.log(el) let elemList = el.querySelectorAll('div.xiaoquInfo > div.xiaoquInfoItem') let result = {} for (let i = 0; i < elemList.length; ++i) { let elem = elemList[i] let label = elem.querySelector('span.xiaoquInfoLabel').innerText.trim() let content = elem.querySelector('span.xiaoquInfoContent').innerText.trim() result[label] = content } return result } async function DoLogic() { await WaitUntil(() => { return !!document.querySelector('div.content__list') }) let divList = document.querySelectorAll('div.content__list--item') for (let i = 0; i < divList.length; ++i) { let div = divList[i] // 获取小区id let a = div.querySelector('p.content__list--item--des > a:nth-of-type(3)') let matches = a.getAttribute('href').match(/zufang\/c(\d+)/) // console.log(a, matches) if (!matches) continue let xiaoquId = matches[1] // 增加跳转到小区的按钮 let tmpA = document.createElement('a') tmpA.setAttribute('href', `/xiaoqu/${xiaoquId}`) tmpA.setAttribute('target', '_blank') tmpA.innerText = '小区主页' a.parentNode.insertBefore(tmpA, a.nextSibling) let tmpSpan = document.createElement('span') tmpSpan.innerText = '-' a.parentNode.insertBefore(tmpSpan, tmpA) let xiaoquInfo = await GetXiaoquInfo(xiaoquId) console.log(xiaoquInfo) let desElem = div.querySelector('p.content__list--item--des') let span = document.createElement('span') span.innerHTML = `<i>/</i> ${xiaoquInfo["建筑年代"]}` desElem.appendChild(span) /* GetXiaoquInfo(xiaoquId).then(xiaoquInfo => { console.log(xiaoquInfo) let desElem = div.querySelector('p.content__list--item--des') let span = document.createElement('span') span.innerHTML = `<i>/</i> ${xiaoquInfo["建筑年代"]}` desElem.appendChild(span) }).catch(err => { console.error(err) }) */ } } (async function () { 'use strict'; // Your code here... await DoLogic() })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址