Greasy Fork

Greasy Fork is available in English.

闲鱼 to 淘宝 Link Converter

Convert Goofish item links to Taobao item links automatically

当前为 2023-04-03 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         闲鱼 to 淘宝 Link Converter
// @namespace    http://tampermonkey/goofish-to-taobao
// @version      1.0.0
// @author       ChatGPT and me
// @license      MIT
// @description  Convert Goofish item links to Taobao item links automatically
// @match        https://h5.m.goofish.com/*
// @grant        none
// @icon         https://img.alicdn.com/tps/i3/TB1eW1eGXXXXXXAXFXXBS8UGFXX-41-22.png

// ==/UserScript==

(function() {
    'use strict';

    const currentUrl = window.location.href; // get the current URL
    const regex = /https:\/\/h5\.m\.goofish\.com\/item\?id=(\d+)/; // regex pattern to match the Goofish link
    const match = regex.exec(currentUrl); // search for the Goofish link using regex

    if (match !== null) {
        const itemId = match[1]; // get the item ID number from the regex match
        const newUrl = `https://item.taobao.com/item.htm?id=${itemId}`; // create the new Taobao URL
        window.location.href = newUrl; // redirect to the new Taobao URL
    }
})();