-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSpotiwebJS.js
More file actions
357 lines (312 loc) · 16.6 KB
/
Copy pathSpotiwebJS.js
File metadata and controls
357 lines (312 loc) · 16.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
// ==UserScript==
// @name SpotiKit++ desktop
// @version 7.0
// @description SpotiKIt — visual premium + AdBlocker for Spotify
// @author kit_fogos
// @match https://www.spotify.com/*/account/*
// @match https://open.spotify.com/*
// @match https://www.spotify.com/*/premium/*
// @match https://www.spotify.com/*/duo/*
// @match https://www.spotify.com/*/student/*
// @match https://www.spotify.com/*/family/*
// @match https://payments.spotify.com/*
// @grant GM_addStyle
// @run-at document-idle
// ==/UserScript==
(function() {
'use strict';
const PINK = '#FFD2D7';
const GREEN = '#1ed760';
GM_addStyle(`
.__sp_curr {
display:inline-block;
background:#535353;
color:#fff;
font-size:11px;
font-weight:700;
padding:3px 8px;
border-radius:3px;
text-transform:uppercase;
letter-spacing:.4px;
}
`);
const REPLACE = {
"Spotify Free": "Premium Individual",
"1 Free account": "1 Premium account",
"1 free account": "1 Premium account",
"Music with ads": "Listen to music ad-free",
"Music listening with ad breaks": "Listen to music ad-free",
"Shuffle play": "Play any song",
"Songs play in shuffle": "Play any song",
"Online only": "Download for offline listening",
"Streaming only": "Download for offline listening",
"No downloads": "Download for offline listening",
"Basic audio quality": "Very high audio quality",
"Normal audio quality": "Very high audio quality",
"Limited skips": "Unlimited skips",
"Free plan": "Premium Individual",
};
function run() {
const b = document.body;
if (!b) return;
const w = document.createTreeWalker(b, NodeFilter.SHOW_TEXT, null, false);
let n;
while (n = w.nextNode()) {
let v = n.nodeValue;
let c = false;
for (const [from, to] of Object.entries(REPLACE)) {
if (v.includes(from)) {
v = v.replaceAll(from, to);
c = true;
}
}
if (c) n.nodeValue = v;
}
document.querySelectorAll('.encore-text-title-medium, [class*="title-medium"]').forEach(el => {
if ((el.textContent || '').trim() === 'Premium Individual') {
el.style.color = window.location.href.includes('/subscription/manage/') ? '#000' : PINK;
const parent = el.closest('[class*="Hjkjj"], [class*="hjkjj"]');
if (parent) {
parent.style.background = PINK;
parent.style.color = '#000';
}
}
});
const planCard = document.querySelector('[data-testid="plan-card"]');
if (planCard && !planCard.querySelector('.__sp_logo')) {
planCard.style.position = 'relative';
const logo = document.createElement('img');
logo.className = '__sp_logo';
logo.src = 'https://i.ibb.co/jPMD5S3K/3-sin-t-tulo-20260704011012.png';
logo.style.cssText = 'position:absolute;top:8px;right:8px;width:24px;height:24px;z-index:10;pointer-events:none;';
planCard.appendChild(logo);
const msg = document.createElement('p');
msg.textContent = 'Your Premium Individual NEVER expires. Dont pay Spotify, fuck their monopoly!';
msg.style.cssText = 'color:#B3B3B3;font-size:14px;margin:8px 0;text-align:left;line-height:1.4;padding:0 4px;';
const btnRow = planCard.querySelector('[class*="dCZPlm"], .sc-3b07dd39-3');
if (btnRow) btnRow.parentNode.insertBefore(msg, btnRow);
}
document.querySelectorAll('h1, h2, h3, h4, strong, span, div[class*="plan"], div[class*="Plan"]').forEach(el => {
const t = (el.textContent || '').trim();
if (t === 'Free' || t === 'Spotify Free' || t === 'Free plan') {
el.textContent = 'Premium Individual';
el.style.color = PINK;
el.style.fontWeight = '700';
}
});
document.querySelectorAll('a, button, [role="button"]').forEach(el => {
const t = (el.innerText || el.textContent || '').trim().toLowerCase();
if (/^(get|buy|join|obtener|conseguir)\s*premium/.test(t)) {
el.textContent = 'DONT JOIN PREMIUM';
el.style.cssText += `background:${PINK}!important;color:#000!important;border:none!important;border-radius:20px!important;font-weight:700!important;pointer-events:none!important;cursor:default!important;`;
el.onclick = e => { e.preventDefault(); e.stopPropagation(); };
}
if (/^(explore|view|explorar|ver)\s*(plans|planes)/.test(t)) {
el.textContent = 'Manage plan';
el.style.cssText += `background:transparent!important;color:#fff!important;border:1px solid #727272!important;border-radius:20px!important;font-weight:700!important;pointer-events:none!important;cursor:default!important;`;
el.onclick = e => { e.preventDefault(); e.stopPropagation(); };
}
if (/^(try|pru[eé]ba)/.test(t)) el.style.display = 'none';
});
document.querySelectorAll('[class*="badge"], [class*="Badge"]').forEach(el => {
if (/^free$/i.test(el.textContent.trim())) {
el.textContent = 'PREMIUM';
el.style.background = PINK;
el.style.color = '#000';
}
});
document.querySelectorAll('table').forEach(tbl => {
tbl.querySelectorAll('td, th').forEach(cell => {
const t = cell.textContent.trim().toLowerCase();
if (!t || t === '—' || t === '-' || t === 'no' || /gratuito|free/.test(t)) {
cell.innerHTML = `<span style="color:${GREEN};font-weight:700;">✓</span>`;
}
});
});
document.querySelectorAll('span[data-encore-id="text"]').forEach(el => {
const t = el.textContent.trim();
if (t === 'Download for offline listening' || t === 'Descarga canciones para disfrutarlas sin conexi\u00f3n' || t === 'Descarga canciones para disfrutarlas sin conexión') {
el.textContent = 'Spotify wont fuck you';
}
});
const upgradeBtn = document.querySelector('[data-testid="upgrade-button"]');
if (upgradeBtn) upgradeBtn.style.display = 'none';
const installBtn = document.querySelector('a[href="/download"]');
if (installBtn) installBtn.style.display = 'none';
const premiumMenu = document.querySelector('a[href*="premium/?ref=web_loggedin_upgrade_menu"]');
if (premiumMenu) premiumMenu.style.display = 'none';
const planesXpath = document.evaluate(
'//a[text()="Planes Premium"] | //span[text()="Planes Premium"] | //div[text()="Planes Premium"] | //a[text()="Premium Plans"] | //span[text()="Premium Plans"] | //div[text()="Premium Plans"]',
document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null
);
for (let i = 0; i < planesXpath.snapshotLength; i++) {
const n = planesXpath.snapshotItem(i);
if (n) n.style.display = 'none';
}
document.querySelectorAll('[aria-label*="Planes Premium"], [aria-label*="Premium Plans"], [data-ga-action="premium"], [data-ga-category="menu"] a, a[href*="/premium/"]').forEach(el => {
const t = el.textContent.trim();
if (t === 'Planes Premium' || t === 'Premium Plans') el.style.display = 'none';
});
const premiumBanner = document.querySelector('[data-testid="compact-banner"]');
if (premiumBanner) {
const wrapper = premiumBanner.closest('.sc-dad329a7-0, [class*="dad329a7"]');
if (wrapper) {
wrapper.style.width = '100%';
}
premiumBanner.style.cssText += `
display:flex !important;
flex-direction:row !important;
background:#2A2A2A !important;
cursor:default !important;
padding:0 !important;
border-radius:8px !important;
overflow:hidden !important;
min-width:unset !important;
width:100% !important;
`;
const left = document.createElement('div');
left.style.cssText = 'flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;row-gap:var(--encore-spacing-tighter-2);padding:var(--encore-spacing-looser) var(--encore-spacing-tighter-2);cursor:pointer;';
const pencilSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
pencilSvg.setAttribute('viewBox', '0 0 16 16');
pencilSvg.setAttribute('role', 'img');
pencilSvg.setAttribute('aria-hidden', 'true');
pencilSvg.style.cssText = 'width:var(--encore-graphic-size-decorative-base);height:var(--encore-graphic-size-decorative-base);';
pencilSvg.innerHTML = `<path fill="white" d="M11.838.714a2.438 2.438 0 0 1 3.448 3.448l-9.841 9.841c-.358.358-.79.633-1.267.806l-3.173 1.146a.75.75 0 0 1-.96-.96l1.146-3.173c.173-.476.448-.909.806-1.267l9.84-9.84zm2.387 1.06a.94.94 0 0 0-1.327 0l-9.84 9.842a1.95 1.95 0 0 0-.456.716L2 14.002l1.669-.604a1.95 1.95 0 0 0 .716-.455l9.841-9.841a.94.94 0 0 0 0-1.327z"/>`;
const leftText = document.createElement('span');
leftText.className = 'e-10561-text encore-text-body-small-bold';
leftText.style.cssText = 'color:var(--text-base);text-align:center;';
leftText.textContent = 'Edit profile';
left.appendChild(pencilSvg);
left.appendChild(leftText);
left.onclick = e => {
e.stopPropagation();
window.location.href = 'https://www.spotify.com/mx/account/profile/';
};
const right = document.createElement('div');
right.style.cssText = 'flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;row-gap:var(--encore-spacing-tighter-2);padding:var(--encore-spacing-looser) var(--encore-spacing-tighter-2);cursor:pointer;border-left:1px solid #404040;';
const cardSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
cardSvg.setAttribute('viewBox', '0 0 16 16');
cardSvg.setAttribute('role', 'img');
cardSvg.setAttribute('aria-hidden', 'true');
cardSvg.style.cssText = 'width:var(--encore-graphic-size-decorative-base);height:var(--encore-graphic-size-decorative-base);';
cardSvg.innerHTML = `<path fill="white" d="M4 11.5h4V10H4z"/><path fill="white" d="M0 3.75C0 2.784.784 2 1.75 2h12.5c.966 0 1.75.784 1.75 1.75v9.5A1.75 1.75 0 0 1 14.25 15H1.75A1.75 1.75 0 0 1 0 13.25zm1.75-.25a.25.25 0 0 0-.25.25V6h13V3.75a.25.25 0 0 0-.25-.25zm-.25 9.75c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V7.5h-13z"/>`;
const rightText = document.createElement('span');
rightText.className = 'e-10561-text encore-text-body-small-bold';
rightText.style.cssText = 'color:var(--text-base);text-align:center;';
rightText.textContent = 'Payment method';
right.appendChild(cardSvg);
right.appendChild(rightText);
right.onclick = e => {
e.stopPropagation();
window.location.href = 'https://www.spotify.com/mx/account/saved-payment-cards/';
};
premiumBanner.innerHTML = '';
premiumBanner.appendChild(left);
premiumBanner.appendChild(right);
}
if (/\/premium\/|\/duo\/|\/student\/|\/family\//.test(window.location.href) && !document.querySelector('.__sp_premium_done')) {
const main = document.querySelector('main') || document.getElementById('__next') || document.body;
const wrapper = document.createElement('div');
wrapper.className = '__sp_premium_done';
wrapper.style.cssText = 'display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:60vh;text-align:center;padding:40px;background:#121212;color:#fff;';
wrapper.innerHTML = `
<h1 style="font-size:32px;font-weight:700;margin-bottom:16px;color:#fff;">You dont need Spotify Premium. Trust me.</h1>
<a href="https://www.spotify.com/" style="display:inline-block;padding:14px 40px;background:#1ed760;color:#000;border-radius:20px;font-weight:700;font-size:16px;text-decoration:none;cursor:pointer;">Back to home</a>
`;
main.innerHTML = '';
main.appendChild(wrapper);
}
if (window.location.hostname === 'payments.spotify.com' && !document.querySelector('.__sp_pay_done')) {
const main = document.querySelector('main') || document.getElementById('root') || document.body;
const wrapper = document.createElement('div');
wrapper.className = '__sp_pay_done';
wrapper.style.cssText = 'display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:100vh;text-align:center;padding:40px;background:#121212;color:#fff;';
wrapper.innerHTML = `
<h1 style="font-size:36px;font-weight:700;margin-bottom:16px;color:#fff;">DONT WASTE YOUR MONEY ON SPOTIFY</h1>
<p style="font-size:18px;margin-bottom:24px;color:#b3b3b3;">Dont give them a cent. Use Spotifuck for free.</p>
<a href="https://open.spotify.com/" style="display:inline-block;padding:14px 40px;background:#1ed760;color:#000;border-radius:20px;font-weight:700;font-size:16px;text-decoration:none;cursor:pointer;">Back to free Spotify</a>
`;
main.innerHTML = '';
main.appendChild(wrapper);
document.querySelectorAll('form, button[type="submit"], [data-testid*="pay"], [data-testid*="checkout"]').forEach(el => {
el.onclick = e => { e.preventDefault(); e.stopPropagation(); };
});
}
}
setTimeout(run, 300);
setTimeout(run, 1200);
let timer;
new MutationObserver(() => {
clearTimeout(timer);
timer = setTimeout(run, 400);
}).observe(document.body, { childList: true, subtree: true });
})();
(async function() {
'use strict';
const removeElements = selector => {
document.querySelectorAll(selector).forEach(el => el.remove());
};
const handleAudioAds = () => {
const audioAd = document.querySelector('audio[src*="spotify.com/ad"]');
if (audioAd) {
audioAd.src = "";
audioAd.pause();
}
};
const inject = ({ ctx, fn, transform }) => {
const original = ctx[fn];
ctx[fn] = function () {
const result = original.apply(this, arguments);
return transform ? transform.call(this, result, ...arguments) : result;
};
};
const observer = new MutationObserver(() => {
removeElements('[data-testid="ad-slot-container"], [class*="ad-"]');
handleAudioAds();
removeElements('.ButtonInner-sc-14ud5tc-0.fcsOIN');
});
observer.observe(document.body, {
childList: true,
subtree: true,
});
const adRemovalInterval = setInterval(() => {
removeElements('[data-testid="ad-slot-container"], [class*="ad-"]');
handleAudioAds();
removeElements('.ButtonInner-sc-14ud5tc-0.fcsOIN');
}, 1000);
const queryAsync = (query, interval = 250) => new Promise(resolve => {
const checkInterval = setInterval(() => {
const element = document.querySelector(query);
if (element) {
clearInterval(checkInterval);
resolve(element);
}
}, interval);
});
const nowPlayingBar = await queryAsync(".now-playing-bar");
const playButton = await queryAsync("button[title=Play], button[title=Pause]");
let audio;
inject({
ctx: document,
fn: "createElement",
transform(result, type) {
if (type === "audio") {
audio = result;
}
return result;
},
});
new MutationObserver(() => {
if (audio && playButton && document.querySelector(".now-playing > a")) {
audio.src = "";
playButton.click();
}
}).observe(nowPlayingBar, {
childList: true,
subtree: true,
});
window.addEventListener('beforeunload', () => {
observer.disconnect();
clearInterval(adRemovalInterval);
});
})();