将京东、B站、淘宝、天猫、微博、知乎、豆瓣手机版网页转换为PC版网页
< 腳本将手机版网页转换为PC版网页的回應
希望能清洗pc端的跟踪链接, 简单改了几条规则,测试通过
// @match *://detail.tmall.com/* // @match *://item.taobao.com/* // @match *://item.jd.com/* { // 京东商品详情页pc regex: /^https?:\/\/item\.jd\.com\/(\d+).*$/, replace: (match, id) => `https://item.jd.com/${id}.html`, description: "京东商品详情页转换" }, { // 天猫pc regex: /^https?:\/\/detail\.tmall\.com\/item\.htm\?(.*)$/, replace: (match, params) => { try { const id = new URLSearchParams(params).get('id'); return id && `https://detail.tmall.com/item.htm?id=${id}`; } catch (error) { return null; } }, description: "天猫商品详情页转换(使用 URLSearchParams 处理参数)" }, { // 淘宝pc regex: /^https?:\/\/item\.taobao\.com\/item\.htm\?(.*)$/, replace: (match, params) => { try { const id = new URLSearchParams(params).get('id'); return id && `https://item.taobao.com/item.htm?id=${id}`; } catch (error) { return null; } }, description: "淘宝商品详情页转换(使用 URLSearchParams 处理参数)" },
登入以回復
希望能清洗pc端的跟踪链接, 简单改了几条规则,测试通过