Created
March 13, 2014 18:13
-
-
Save jleclanche/9533710 to your computer and use it in GitHub Desktop.
Get plaintext patchnotes from the command line
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
function patchnotes { | |
ua="Battle.net/1.0.8.4217" | |
_baseurl="https://us.battle.net/connect/en/app" | |
usage="usage: $0 <product> [live|ptr|beta]\nproduct is one of wow, s2, d3, wtcg" | |
hash lynx 2>/dev/null || { | |
echo "You need to install Lynx first." | |
return 1 | |
} | |
if [[ $1 == ("--help"|"-h") ]]; then | |
echo $usage | |
return 0 | |
fi | |
if [[ $# == 0 || $1 != ("wow"|"s2"|"d3"|"wtcg") ]]; then | |
echo $usage | |
return 1 | |
fi | |
if [[ $# == 1 ]]; then | |
product="live" | |
else | |
product=$2 | |
fi | |
lynx -dump -useragent=$ua "$_baseurl/$1/patch-notes?productType=$product" 2> /dev/null | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment