Hacking Gmail

(Grace) #1

194 Part III — Conquering Gmail


Listing 13-6 (continued)

$stream->get_tag(“td”);
my $dateline = $stream->get_trimmed_text(“tr”);

$stream->get_tag(“td”);
my $to_line = $stream->get_trimmed_text(“tr”);

$stream->get_tag(“div”);
$stream->get_tag(“div”);
my $message_text = $stream->get_text(“/div”);

print
“ \nSENDER $from_true_name $from_email_address \nSUBJECT
$subject\nDATE: $dateline \nTO: $to_line\nMESSAGE:
$message_text\n”;

Running this script — again, as with Listing 13-3, it works on the page saved to
disk — produces the output shown in Figure 13-3.

So this is increasingly useful: You can retrieve the Inbox, find a ThreadID, and
bring down a message if the thread contains only one message. You can then take
that message and grab the information out of it.

FIGURE13-3: The result of running Listing 13-6
Free download pdf