Compare commits

6 Commits

Author SHA1 Message Date
723c8af2ba Nahrát soubory do „/“ 2026-09-24 19:13:41 +00:00
2e567e638b Aktualizovat content.js 2026-09-23 15:29:28 +00:00
9e2cc10160 Aktualizovat content.js 2026-09-23 15:22:04 +00:00
de82ebd56f Aktualizovat content.js 2026-09-23 15:10:32 +00:00
876a537354 Nahrát soubory do „/“ 2026-09-19 22:00:28 +00:00
3dcec7d43f Odstranit proces.txt 2026-09-19 22:00:00 +00:00
4 changed files with 82 additions and 17 deletions

62
content.js Normal file
View File

@@ -0,0 +1,62 @@
const TARGET_URL = "http://localhost:8080/endpoint";
let lastSentSignature = "";
function extractAndSendSong() {
const trackInfo = document.querySelector('[data-testid="now-playing-widget"]');
if (trackInfo) {
const links = trackInfo.querySelectorAll('a');
const songTitle = links[0] ? links[0].innerText : null;
const artistName = links[1] ? links[1].innerText : "Unknown Artist";
// Získání obrázku alba
const imgElement = trackInfo.querySelector('img');
const albumCoverUrl = imgElement ? imgElement.src : null;
// Získání času
const currentTimeEl = document.querySelector('[data-testid="playback-position"]');
const durationEl = document.querySelector('[data-testid="playback-duration"]');
const currentTime = currentTimeEl ? currentTimeEl.innerText : "0:00";
const duration = durationEl ? durationEl.innerText : "0:00";
const progressFull = `${currentTime}/${duration}`;
// Spolehlivější detekce reklamy:
// Reklamy na Spotify trvají vždy přesně 30 vteřin (0:30) nebo nemají běžné odkazy na skladbu
const isAd = (duration === "0:30") || (links.length < 2) || (songTitle === null);
const finalTitle = isAd ? "Reklama" : songTitle;
const finalArtist = isAd ? "Spotify" : artistName;
if (finalTitle || isAd) {
const currentSignature = `${finalArtist}-${finalTitle}-${currentTime}-${isAd}`;
if (currentSignature !== lastSentSignature) {
lastSentSignature = currentSignature;
console.log("Odesílám data:", finalArtist, "-", finalTitle, `[${progressFull}]`, "Reklama:", isAd);
fetch(TARGET_URL, {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
artist: finalArtist,
title: finalTitle,
coverImg: albumCoverUrl,
progressTime: progressFull,
ad: isAd ? "true" : "false",
timestamp: new Date().toISOString()
})
}).catch(err => {
console.error("Chyba při odesílání:", err);
});
}
}
}
}
// Kontrola každou vteřinu
setInterval(extractAndSendSong, 1000);

20
manifest.json Normal file
View File

@@ -0,0 +1,20 @@
{
"manifest_version": 3,
"name": "Spotify IP Sender",
"version": "1.0",
"permissions": [
"activeTab",
"storage"
],
"host_permissions": [
"https://open.spotify.com/*",
"http://*/*",
"https://*/*"
],
"content_scripts": [
{
"matches": ["https://open.spotify.com/*"],
"js": ["content.js"]
}
]
}

View File

@@ -1,17 +0,0 @@
T:
19.9
zacal jsem tim ze jsem vyjmul kartu z toho RP a zalohoval ji do .img souboru. flashnuljsem novy lehky konzolovy OS do toho RP.
snazim jse najit spusob jak ziskat nazev songy ktera prave hraje ve spotify ve prohlizeci na laptopu ktery bude na jarmarku a na nem se bude poustet hudba.
a jeste jse snazim vymyslet jak to udelat aby ten laptop potom poslal ten nazev ty songy na hlavni server.
zjistovani songy ktera prave hraje asi udelame cez nejaky kod a ne cez chrome extention
O:
M:

BIN
spotify-sender.zip Normal file

Binary file not shown.