#!/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
GET /feeds/download/documents/Export?docID=resource_id&exportFormat=format
<gd:resourceId>
document:0ASpnxqo7zPlfZGQ3Z2Zwc183Zzc3NnZkY2g</gd:resourceId>
Source: https://habr.com/ru/post/85298/
All Articles