Using wget to receive an XML atom feed of your Gmail inbox

wget -O - 'https://USERNAMEHERE:PASSWORDHERE@mail.google.com/mail/feed/atom' --no-check-certificate
I use this command in my Conky script to display the number of messages in my Gmail inbox and to list the from: and subject: fields.
Sample Output
?xml version="1.0" encoding="UTF-8"?>
<feed version="0.3" xmlns="http://purl.org/atom/ns#">
<title>Gmail - Inbox for patrick.archibald@gmail.com</title>
<tagline>New messages in your Gmail Inbox</tagline>
<fullcount>1</fullcount>
<link rel="alternate" href="http://mail.google.com/mail" type="text/html" />
<modified>2010-09-26T14:39:24Z</modified>
<entry>
<title>Your Order with Amazon.com</title>
<summary>Amazon.com Logo Thanks for your order, Patrick L Archibald! Want to manage your order online? If ...</summary>
<link rel="alternate" href="http://mail.google.com/mail?account_id=patrick.archibald@gmail.com&amp;message_id=12b496e5d987360c&amp;view=conv&amp;extsrc=atom" type="text/html" />
<modified>2010-09-25T15:06:30Z</modified>
<issued>2010-09-25T15:06:30Z</issued>
<id>tag:gmail.google.com,2004:1347868102431815180</id>
<author>
<name>auto-confirm@amazon.</name>
<email>auto-confirm@amazon.com</email>
</author>
</entry>
</feed>

-3
By: PLA
2010-09-26 14:47:13

What Others Think

For people using funny caracters in their password (such as @ #?or $ ... ) consider using ASCII HEX equivalent to make this work
snaguber · 417 weeks ago
how to extract xml data by just hitting the url eg: this is the url http://www.pistonheads.co.uk/xml/news091.asp?c=26 i want to extract the xml data of it.. like PistonHeads (Motoring News) http://www.pistonheads.com/news/ Motoring News Bowler Nemesis Joins Spyker At CPP http://www.pistonheads.com/news/default.asp?storyId=23325 Plans confired for Nemesis EXR road car to be built in Coventry Monday, 14 March 2011 GMT wat is the command to get the xml output from the url ??
planet100 · 392 weeks and 6 days ago
Saw your question Planet100 try using curl, you might need some sed/awk magic, which I cannot help with, but that is a start at least. With curl and some extra effort you could also make the titles clickable links, I think there are other possibly better ways to do it though.
tomjrace · 374 weeks and 5 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: