196 Part III — Conquering Gmail
This is a simple matter. When I opened each of these folders, I found these URLS:
Inbox:http://gmail.google.com/gmail/h/q2fuyjw4p8mu/?
Starred:http://gmail.google.com/gmail/h/q2fuyjw4p8mu/?s=r
Sent Mail:http://gmail.google.com/gmail/h/q2fuyjw4p8mu/?s=s
Drafts:http://gmail.google.com/gmail/h/q2fuyjw4p8mu/?s=d
All Mail:http://gmail.google.com/gmail/h/q2fuyjw4p8mu/?s=a
Spam:http://gmail.google.com/gmail/h/q2fuyjw4p8mu/?s=m
Trash:http://gmail.google.com/gmail/h/q2fuyjw4p8mu/?s=t
Ignoring the random seed again, you can see that the s=attribute sets the folder
to view. Setting it to anything else but the preceding options returns an error,
except, happily setting it to s=i, which gives you the Inbox.
So, to retrieve the mail from another folder, you simply form the URL as in the
preceding list, send it to the scraping script you wrote earlier in this chapter, and
proceed from there.
And Now
So, you now have the basic techniques down for interacting with the HTML-only
version of Gmail. You now know how to scrape the pages, and you now know how
to find and, in theory, gather information from, all of the messages. In the next
chapter, you learn how to export your mail, whether for re-import into another
application or to back it up. As good as Gmail is, always being able to leave is
sometimes a good excuse to stay.