Skip to content

Instantly share code, notes, and snippets.

@petja
Last active April 15, 2025 18:56
Show Gist options
  • Save petja/3a47a674c912ea32cd111acdf48d1201 to your computer and use it in GitHub Desktop.
Save petja/3a47a674c912ea32cd111acdf48d1201 to your computer and use it in GitHub Desktop.
Download Fööni videos
# Prerequisites: htmlq, curl
# On Mac install with: brew install htmlq curl
# You can find the token by signing into your Fööni account, opening sidebar and checking the URL of "Flight videos" link. Token is hex string with the length of 64 characters (32 bytes).
# Warning! Don't share the token, it allows malicious actor to see your personal information!
LOGIN_TOKEN="_____REPLACE_ME_____"
TARGET_DIRECTORY="/tmp/fooni-videos"
mkdir -p "$TARGET_DIRECTORY"
videopage_html=$(curl -Lsc "/tmp/cookiejar" "https://media.xn--fni-snaa.fi/index.php?ctrl=api&do=proflyer_login&login_token=$LOGIN_TOKEN")
urls=$(echo "$videopage_html" | htmlq -a href '.download_link')
while IFS= read -r url; do
normalized_url=$(echo "$url" | sed 's/fööni/xn--fni-snaa/g')
media_token=$(echo "$normalized_url" | sed -n 's/.*[?&]media_token=\([^&]*\).*/\1/p')
curl -L "$normalized_url" -o "$TARGET_DIRECTORY/$media_token.mp4"
done <<< "$urls"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment