Open GoogleCodeExporter opened 8 years ago
Good idea. (Probably switch rather than if.)
I've added this to
http://code.google.com/p/winetricks/wiki/SummerOfCode
Original comment by daniel.r...@gmail.com
on 20 Mar 2011 at 11:13
It seems that some `case $LANG in ...` stuffs would be used to deal with all
the languages since there are so many to choose from.
With a given MS Download id (that ?id=5793 in the HTML Query), download URLs
for each locale available can be obtained like this:
```Bash
#! /bin/bash
# INCOMPLETE: Regex.. Ahhhh
ID=5793
# Guess sed version by using help
_esed(){ if sed --help >/dev/null; then sed -r "$@"; else sed -E "$@"; fi }
# Oh crap I hate regex
LOCALES=$(curl http://www.microsoft.com/en-us/download/details.aspx?id=$ID |
grep -A1 newlocale | _esed -e '/RegexToMatchTheCreepyValueAttuibuteInOption/\1
/p')
# The option tags looks like this, and we need the value attribute:
# <option value="zh-CN">Chinese (Simplified)</option><option
value="zh-TW">Chinese (Traditional)</option><option
value="cs-CZ">Czech</option><option value="da-DK">Danish</option><option
value="nl-NL">Dutch</option><option selected="selected"
value="en-US">English</option><option value="fi-FI">Finnish</option><option
value="fr-FR">French</option><option value="de-DE">German</option><option
value="el-GR">Greek</option><option value="he-IL">Hebrew</option><option
value="hu-HU">Hungarian</option><option value="it-IT">Italian</option><option
value="ja-JP">Japanese</option><option value="ko-KR">Korean</option><option
value="nb-NO">Norwegian (Bokmål)</option><option
value="pl-PL">Polish</option><!-- And much more -->
for i in $LOCALES; do
printf $i'\t'
curl http://www.microsoft.com/$i/download/confirmation.aspx?id=$ID | grep start-download | # Again, get the href attribute from the a tag..
done
Original comment by `arthur200126` on 6 Feb 2015 at 3:53
Hmm.. Just ignore the sed stuff and take what I posted as pseudo-sh-code.
Original comment by arthur200126
on 6 Feb 2015 at 4:18
Final Script.
```sh
#! /bin/sh
ID=${1-5793}
FILEEXT=${2-(msi|exe)}
echo "Download links for MS package ID $ID:" >&2
# So it doesn't get jammed with cut in stdout
# We can do one more grep to get the name of the package but it's not really useful.
# BUF=$(curl --silent sameURL); NAME=$(echo $BUF | grep -A1 '<h1>' | tail -n 1); LOCALES=$(echo $BUF | same thing);
LOCALES=$(curl --silent
http://www.microsoft.com/en-us/download/details.aspx?id=$ID | grep -A1
newlocale | grep -Eo '[a-z]{2}-[A-Z]{2}')
for i in $LOCALES; do
printf $i'\t'
curl --silent http://www.microsoft.com/$i/download/confirmation.aspx?id=$ID | grep 'failover' | grep -Eio 'http://download.microsoft.com/download/([0-9a-f]/){3}[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/.*\.'$FILEEXT
done
Original comment by `arthur200126` on 6 Feb 2015 at 5:18
Microsoft always do something unexpected..
curl --silent http://www.microsoft.com/$i/download/confirmation.aspx?id=$ID | grep 'failover' | grep -Eio 'http://download.microsoft.com/download/([0-9a-f]/){3}[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/.*\.'$FILEEXT | head -n 1
Why were there so many links on confirmation for XP SP3…
Original comment by arthur200126
on 6 Feb 2015 at 5:21
Original issue reported on code.google.com by
Lukasz.W...@gmail.com
on 18 Mar 2011 at 9:00Attachments: