NSFW-Profile Auto Redirector

Redirects OnlyFans and Fansly to Coomer search pages, Patreon and Boosty to Kemono search pages, using the username from the URL.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         NSFW-Profile Auto Redirector
// @name:en      NSFW-Profile Auto Redirector
// @namespace    https://greasyfork.org/en/users/1373266-godinraider
// @version      1.1
// @description  Redirects OnlyFans and Fansly to Coomer search pages, Patreon and Boosty to Kemono search pages, using the username from the URL.
// @description:en Redirects OnlyFans and Fansly to Coomer search pages, Patreon and Boosty to Kemono search pages, using the username from the URL.
// @author       Inspired by GodinRaider
// @match        *://*.onlyfans.com/*
// @match        *://*.patreon.com/*
// @match        *://*.fansly.com/*
// @match        *://*.boosty.to/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function () {
    'use strict';

    // Function to extract username from URL
    function getUsername() {
        const path = window.location.pathname.replace(/^\/+|\/+$/g, ''); // Remove leading/trailing slashes
        return path.split('/')[0]; // Get the first part of the path (username)
    }

    // Function to perform the redirect
    function redirectToSearchOrProfile() {
        const username = getUsername();

        // If no username is found, do nothing
        if (!username) return;

        // Determine the current site and redirect accordingly
        const isPatreon = window.location.hostname.includes('patreon.com');
        const isBoosty = window.location.hostname.includes('boosty.to');
        const isFansly = window.location.hostname.includes('fansly.com');
        const isOnlyFans = window.location.hostname.includes('onlyfans.com');

        let redirectUrl = '';

        if (isPatreon) {
            redirectUrl = `https://kemono.cr/artists?q=${username}&service=patreon&sort_by=favorited&order=desc`;
        } else if (isBoosty) {
            redirectUrl = `https://kemono.cr/artists?q=${username}&service=boosty&sort_by=favorited&order=desc`;
        } else if (isFansly) {
            redirectUrl = `https://coomer.st/artists?q=${username}&service=fansly&sort_by=favorited&order=desc`;
        } else if (isOnlyFans) {
            redirectUrl = `https://coomer.st/artists?q=${username}&service=onlyfans&sort_by=favorited&order=desc`;
        }

        // Perform the redirect if a URL is set
        if (redirectUrl) {
            window.location.href = redirectUrl;
        }
    }

    // Execute the redirect
    redirectToSearchOrProfile();
})();