Last active
April 14, 2022 05:39
-
-
Save remi/da04f16bd05250a6283dc3b1ca9a1ef3 to your computer and use it in GitHub Desktop.
Extract canonical URL from Apple News URL
This file contains hidden or 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/bash | |
# Usage: | |
# | |
# 1. Create a `apple-news` file somewhere in your $PATH with the content of this file | |
# 2. That’s it! You can now use the `apple-news` utility: | |
# | |
# ``` | |
# $ apple-news https://apple.news/AKoDCWtVEQP2w7Ld657lgIg | |
# https://www.theguardian.com/technology/2022/mar/30/dyson-launches-zone-air-purifying-bluetooth-headphones-with-visor | |
# ``` | |
curl -s -XGET $1 | grep "redirectToUrl(\"" | sed -e "s/^ *redirectToUrl(\"//" | sed -e "s/\");$//" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment