Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to parse Gmail chat logs from webpage?
    text
    copied!<p>What would be the best way to parse Gmail chat logs from the webpage where it's displayed? As far as I know, this is still the only way to access server-hosted Gmail chat logs (through either desktop Gmail or mobile Gmail).</p> <p>When looking at the generated source where the conversation takes place, the markup looks like nested divs and spans (and the divs elsewhere on the page have randomized two-character ids and classes with no pattern). Here's an excerpt from a line that has a timestamp to the left:</p> <pre><code>&lt;div&gt; &lt;span style="display:block;float:left;color:#888"&gt; 2:56 PM&amp;nbsp; &lt;/span&gt; &lt;span style="display:block;padding-left:6em"&gt; &lt;span&gt; &lt;span style="font-weight:bold"&gt;me&lt;/span&gt;: i'm trying to think of a good way to parse gmail chat logs &lt;/span&gt; &lt;/span&gt; &lt;/div&gt; </code></pre> <p>But not every line has a timestamp, so those without one seem to place nonbreaking spaces in its place:</p> <pre><code>&lt;div&gt; &lt;span style="display:block;float:left;color:#888"&gt; &amp;nbsp;&amp;nbsp; &lt;/span&gt; &lt;span style="display:block;padding-left:6em"&gt; &lt;span&gt; and reformat that into something like an xml format &lt;/span&gt; &lt;/span&gt; &lt;/div&gt; </code></pre> <p>Should I use XPath? Is there something more efficient?</p> <p>Edit:</p> <p>As data only, this is what it looks like:</p> <pre><code>12:43 AM John: Something something something. Something something something. me: Something something something? 12:44 AM Also, something something something. 12:47 AM Something something something. 12:48 AM Something something something with something something something. 12:49 AM John: Something. </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload