ХабрПостыНовостиМегапосты?

Скачиваем Google Docs без браузера

Скриптик выглядит как-то так:

#!/bin/bash
token=$(curl -s www.google.com/accounts/ClientLogin -d Email=user.name@gmail.com -d Passwd=qwerty -d accountType=GOOGLE -d service=writely -d Gdata-version=3.0 |cut -d "=" -f 2)
set $token
curl --silent --header "Gdata-Version: 3.0" --header "Authorization: GoogleLogin auth=$3" "http://docs.google.com/feeds/user.name@gmail.com/private/full" | tidy -xml -indent -utf8 -quiet > /tmp/gdocs.xml
file=(doc1 doc2 doc3 doc4)
resourceId=(document:0ASpnxqo7zPlfZGQ3Z2Zwc183NWZteDNiM2Y ...) # и ещё 3 resourceId
i=0
while (( i < 4 )) # match num_files
do
wget --header "Gdata-Version: 3.0" --header "Authorization: GoogleLogin auth=$3" "https://docs.google.com/feeds/download/documents/Export?docID=${resourceId[$i]}&exportFormat=txt" -O /tmp/${file[$i]}.txt

sleep 2
i=$i+1
done

А теперь, как принято, разоблачение.
Написано на скорую руку, поэтому любые замечания и критика приветствуются.
@temujin
23.02.2010 16:33 UTC
Первоисточник