您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
asdf
当前为
// ==UserScript== // @name HTML5 thingie for Spotify Web Player // @namespace https://gf.zukizuki.org/users/4813-swyter // @match https://play.spotify.com/* // @version 2015.11.20 // @noframes // @icon https://i.imgur.com/CecLLKu.png // @grant none // @run-at document-start // @description asdf // ==/UserScript== / * SWFobject.js faker, sneaky! * / Object.defineProperty(window, 'swfobject', { configurable: false, writable: false, value: { getFlashPlayerVersion: function(){ console.log("-<-< getFlashPlayerVersion =>", arguments); return { major: 11, minor: 2, release: 202 }; }, hasFlashPlayerVersion: function(){ console.log("-<-< hasFlashPlayerVersion =>", arguments); return true; }, embedSWF: function(swf, parent_id, unk_a, unk_b, req_flash_ver, unk_c, properties) { console.log("-<-< embedSWF =>", arguments, arguments[9].toString(), this, properties); function dowork(ping) { //http://crossorigin.me/http://ping-pong.spotify.nodestuff.net/64-104-120-204-164-75-214-221-224-109-28-127-73-236-239-150-88-238-177-90 console.log("ping-pong", ping); function worker_code() { var xhr = new XMLHttpRequest(); xhr.open("GET", "https://crossorigin.me/http://ping-pong.spotify.nodestuff.net/" + ping.replace(/ /g,"-"), false); xhr.responseType = "json"; xhr.send(); } var xhr_worker = new Worker(new Blob(aFileParts, {type : 'text/html'})); xhr_worker.postMessage(ping); // believe me, i know this sucks //while(xhr.readyState != xhr.DONE){} console.log("pong", xhr); return xhr.response.pong.replace(/-/g," "); } var dummy = document.createElement("audio"); dummy.id = properties.id; dummy.sp_run = function(proof){ console.log("-<-< sp_run =>", arguments); return dowork(proof); }; dummy.sp_hasSound = function(){ return true }; dummy.__noSuchMethod__ = function(name,params) { console.log('==>>== > invalid function call', name, params); }; var handler = { get: function(target, name) { if (name in dummy) return dummy[name](); else console.log("Proxy =>", target, name); } }; window.document[properties.id] = dummy; //new Proxy({}, handler); // {};//dummy; parent_elem = document.getElementById(parent_id) parent_elem.appendChild(dummy); // tell the spotify framework that the swf embed is ready arguments[9].apply(this, [{success: true}]); // act as the swf bridge and tell it that the Flash-backend is ready // JSInterface.notify(ApplicationEvents.READY,null,1); Spotify.Instances.get(properties.instanceId).audioManager.getInterface()._triggerDeferred('FLASH_AVAILABLE', null); Spotify.Instances.get(properties.instanceId).audioManager.getInterface()._triggerDeferred('READY', null); console.log("AUDIOMANAGER-INTERFACE", properties.id, window.document[properties.id], Spotify.Instances.get(properties.instanceId).audioManager.getInterface(), Spotify.Instances.get(properties.instanceId).audioManager.getInterface().hasSound()) } } }); function when_external_loaded() { // --- window.swfobject = {}; /* wait until the page is ready for the code snippet to run */ document.addEventListener('DOMContentLoaded', function() { console.log("!!! DOMContentLoaded"); window.swfobject = {}; /* / * SWFobject.js faker, sneaky! * / Object.defineProperty(window, 'swfobject', { configurable: false, writable: false, value: { getFlashPlayerVersion: function(){ console.log("-<-< getFlashPlayerVersion =>", arguments); return { major: 11, minor: 2, release: 202 }; }, hasFlashPlayerVersion: function(){ console.log("-<-< hasFlashPlayerVersion =>", arguments); return true; }, embedSWF: function(){ console.log("-<-< embedSWF =>", arguments); } } }); */ WebSocket.prototype.sond = WebSocket.prototype.send; WebSocket.prototype.send = function(msg) { if (this.onmessage && this.sucks !== true) { callback = this.onmessage; console.log("orig prev callback:", callback); this.onmessage = function(message) { var json_msg = JSON.parse(message.data); if (json_msg.id === window.last_track_msg) console.info("<- ws recv: ", window.last_track_msg, message.data); if (json_msg && json_msg.result && json_msg.result.uri) open(json_msg.result.uri); callback(message); } this.sucks = true; } var json_msg = JSON.parse(msg); // get http link if (json_msg && json_msg.name == 'sp/track_uri') { arguments[0] = msg.replace(',"rtmp"', ''); window.last_track_msg = json_msg.id; console.info("-> ws send: ", json_msg.id, msg); } //dec_msg = json_msg.name === 'sp/hm_b64' ? atob(json_msg.args[0]) : null; //console.info("-> ws send: ", msg); //json_msg, dec_msg); //if (json_msg.name !== 'sp/log') return WebSocket.prototype.sond.apply(this, arguments); } }); // --- } /* inject this cleaning function right in the page to avoid silly sandbox-related greasemonkey limitations */ window.document.head.appendChild( inject_fn = document.createElement("script") ); inject_fn.innerHTML = '(' + when_external_loaded.toString() + ')()';