const fs = require('fs');
let variables = encodeURIComponent(JSON.stringify({
"artistId": "spotify:artist:7GlWO28gZUISE31g9DKweR"
}))
let extension = encodeURIComponent(JSON.stringify({ "persistedQuery": { "version": 1, "sha256Hash": "<YOUR_SHA_TOKEN>"}}))
let operation = "artistConcerts"
fetch(`https://api-partner.spotify.com/pathfinder/v1/query?operationName=${operation}&variables=${variables}&extensions=${extension}`, {
"headers": {
"accept": "application/json",
"accept-language": "en",
"app-platform": "WebPlayer",
"authorization": "<YOUR_BEARAR_TOKEN>",
"cache-control": "no-cache",
"client-token": "<YOUR_CLIENT_TOKEN>",
"content-type": "application/json;charset=UTF-8",
"pragma": "no-cache",
"priority": "u=1, i",
"sec-ch-ua": "\"Not/A)Brand\";v=\"8\", \"Chromium\";v=\"126\", \"Google Chrome\";v=\"126\"",
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": "\"Windows\"",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"spotify-app-version": "1.2.41.282.g67f2a22e",
"Referer": "https://open.spotify.com/",
"Referrer-Policy": "strict-origin-when-cross-origin"
},
"body": null,
"method": "GET"
})
.then(response => response.json())
.then(data => {
console.log(data)
fs.writeFileSync("./direct-events-ru.json", JSON.stringify(
data
, null, 2))
})