Open in Spotify Desktop client

Opens spotify links in the desktop app

目前为 2023-07-26 提交的版本。查看 最新版本

// ==UserScript==
// @name         Open in Spotify Desktop client
// @description  Opens spotify links in the desktop app
// @version      0.2
// @author       yungsamd17
// @namespace    https://github.com/yungsamd17/UserScripts
// @license      MIT License
// @icon         https://www.google.com/s2/favicons?sz=64&domain=spotify.com
// @match        https://open.spotify.com/*
// @run-at       document-start
// @noframes
// ==/UserScript==

(function() {
    'use strict';
    var data=document.URL.match(/[\/\&](track|playlist|album|artist|show|episode)\/([^\&\#\/\?]+)/i);
    console.log("This is a "+data[1]+" with id:"+data[2]+"\nAttempting to redirect");
    window.location.replace('spotify:'+data[1]+':'+data[2]);

    setTimeout(function() {
      console.log("Closing tab");
      window.close();
    }, 100);
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址