Last active
January 19, 2024 12:51
-
-
Save Caellian/947e9b7b0f9d42278b9308765dc4ec08 to your computer and use it in GitHub Desktop.
Emoji list update
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
#!/bin/env sh | |
function check_version() { | |
curl -s "https://unicode.org/Public/cldr/$1/" | grep -o "core.zip<" >/dev/null && echo 0 || echo 1 | |
} | |
function cldr_versions() { | |
curl -s "https://unicode.org/Public/cldr/" | grep -oP "(?<=<li><a href=\")\d+(\.\d+)*" | tac | |
} | |
echo "Downloading version list..." | |
for v in $(cldr_versions); do | |
echo "Checking version $v..." | |
if [[ $(check_version $v) -eq 0 ]]; then | |
echo "Downloading CLDR v$v..." | |
curl "https://unicode.org/Public/cldr/$v/core.zip" -o "cldr-core.zip" | |
break | |
fi | |
done | |
echo "Extracting zip contents..." | |
unzip "cldr-core.zip" common/annotations/en.xml -d . | |
echo "Formatting sequences..." | |
cat common/annotations/en.xml | | |
grep -shP "annotation cp=\".\">" | | |
sed -Ee "s/\s+<annotation cp=\"//g; s/\">/ /g; s|</annotation>||g; s/\s\|\s/, /g" > emoji_list | |
echo "Cleaning up CLDR files..." | |
rm -rf common cldr-core.zip | |
echo "Done." |
Fixed. Regex for extracting versions from version directory was broken.
I'm afraid cldr_versions() no longer returns anything. Would you mind updating it please?
@karimb Updated. They changed version list to use list element instead of a table.
@Caellian Thanks 🙂 I think you should have a donation link somewhere. Even small donations are encouraging 😉
@karimb Np, thanks for letting me know.
I don't feel like donations for this script would be justifiable given that I left it as a comment on Luke's video and it took very little effort to write it and keep it updated (3 minor revisions in 3 years).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Please, update the script, it's unable to download now the .zips :|