You are not logged in.

#1 2011-01-24 23:17:06

sduvick
Member
Registered: 2010-12-30
Posts: 8

Google Tasks Script

I was looking for a way to access my Google Tasks, eventually to put into a widget for Awesome WM, so I created this script. it's based on http://privacylog.blogspot.com/2010/07/ … tasks.html but has some changes. That script created an e-mail that got sent to your spam folder, where mine will sort out the list, make it readable, and print it out of stdout. This also saves the list in your home directory.

#!/bin/bash
cd $HOME

curl https://www.google.com/accounts/ClientLogin \
-d Email=YOURUSERNAME@gmail.com \
-d Passwd=YOUR PASSWORD \
-d source=privacylog \
-d service=goanna_mobile > token

AUTH=$(sed -n 's/Auth=/auth=/p' token)
HEADER="Authorization: GoogleLogin $AUTH"
URL="https://mail.google.com/tasks/ig"
curl --header "$HEADER" "$URL" > tasks

grep -o "\"\(name\|task_date\|notes\)\":\"[^\"]*\"" tasks > templist

grep "name" templist | awk -F : '{print $2}' > list

rm templist

cat list | awk -F \" '{print $2}' > betterlist

#removes a blank line and task list name
#if you don't have the blank line and task list name
#you may want to remove these two lines
sed -i '$d' betterlist
sed -i '$d' betterlist

cat betterlist > list

#to only print the list, not save the list,
#uncomment the list in the next line

rm token tasks betterlist #list

Offline

Board footer

Powered by FluxBB