Last active
November 6, 2024 18:23
-
-
Save AlexGodard/0514a35b769e942acec796efa0a8c7a4 to your computer and use it in GitHub Desktop.
Fotmob
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import crypto from "node:crypto"; | |
// Make sure to have no new lines at the start and end | |
const secretLyrics = `We're no strangers to love | |
You know the rules and so do I | |
A full commitment's what I'm thinking of | |
You wouldn't get this from any other guy | |
I just wanna tell you how I'm feeling | |
Gotta make you understand | |
Never gonna give you up | |
Never gonna let you down | |
Never gonna run around and desert you | |
Never gonna make you cry | |
Never gonna say goodbye | |
Never gonna tell a lie and hurt you | |
We've known each other for so long | |
Your heart's been aching but you're too shy to say it | |
Inside we both know what's been going on | |
We know the game and we're gonna play it | |
And if you ask me how I'm feeling | |
Don't tell me you're too blind to see | |
Never gonna give you up | |
Never gonna let you down | |
Never gonna run around and desert you | |
Never gonna make you cry | |
Never gonna say goodbye | |
Never gonna tell a lie and hurt you | |
Never gonna give you up | |
Never gonna let you down | |
Never gonna run around and desert you | |
Never gonna make you cry | |
Never gonna say goodbye | |
Never gonna tell a lie and hurt you | |
Never gonna give, never gonna give | |
(Give you up) | |
We've known each other for so long | |
Your heart's been aching but you're too shy to say it | |
Inside we both know what's been going on | |
We know the game and we're gonna play it | |
I just wanna tell you how I'm feeling | |
Gotta make you understand | |
Never gonna give you up | |
Never gonna let you down | |
Never gonna run around and desert you | |
Never gonna make you cry | |
Never gonna say goodbye | |
Never gonna tell a lie and hurt you | |
Never gonna give you up | |
Never gonna let you down | |
Never gonna run around and desert you | |
Never gonna make you cry | |
Never gonna say goodbye | |
Never gonna tell a lie and hurt you | |
Never gonna give you up | |
Never gonna let you down | |
Never gonna run around and desert you | |
Never gonna make you cry | |
Never gonna say goodbye`; | |
const createXFmReqHeader = (path: string) => { | |
const body = { | |
url: path, | |
code: new Date().getTime(), | |
}; | |
const signature = crypto | |
.createHash("md5") | |
.update(`${JSON.stringify(body)}${secretLyrics}`) | |
.digest("hex") | |
.toUpperCase(); | |
return btoa( | |
JSON.stringify({ | |
body: body, | |
signature: signature, | |
}), | |
); | |
}; | |
const path = "<your_path>"; // example: /api/leagues?id=130&ccode3=CAN | |
const response = await fetch(`https://www.fotmob.com${path}`, { | |
headers: { | |
"Content-Type": "application/json", | |
"x-fm-req": createXFmReqHeader(path), | |
}, | |
}); | |
const body = await response.json(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment