Closed BrendonGames closed 2 years ago
Looks like the ScoreSaber API or frontend changed :/ I'll look into it.
It is because ScoreSaber no longer serves the country flags pictures. It is using twemoji's image.
https://scoresaber.com/imports/images/flags/ca.png
will return 404 instead of the flag for Canada.
Here is how ScoreSaber fetches the twimoji https://github.com/ScoreSaber/ScoreSaber-Frontend/blob/main/src/lib/components/image/country-image.svelte
Although I’m not good enough to get the image, I have managed to rewrite the code a little to add the country as text:
Here's the scriptable file for plain text country: ScoreSaber.zip
The flag image returned by twimoji is svg and I did some google found out Scriptable doesn't really have a good support for svg.
Here is the code I copied from the ScoreSaber frontend.
const toTwemojiFlag = (input) =>
`https://twemoji.maxcdn.com/v/13.1.0/svg/${input
.toLowerCase()
.match(/[a-z]/g)
.map((i) => (i.codePointAt(0) + 127365).toString(16))
.join('-')}.svg`;
const toEmojiFlag = (countryCode) => countryCode.toLowerCase().replace(/[a-z]/g, (i) => String.fromCodePoint((i.codePointAt(0) ?? 0) - 97 + 0x1f1e6));
toTwemojiFlag
will return a url to the country flag svg which we can't use at the moment.
toEmojiFlag
will directly return the Unicode emoji for the input country code. For example "CA"
=> 🇨🇦
Use the unicode conversion is working
Will make a pr
The title is the error i’m receiving and I have no idea why it happens.
here’s a photo of the error:
I’ve been using this widget for a while and it suddenly stopped working. I waited a few hours and reinstalled, but it still doesn’t work.