Earlier today I wanted to analyse the downloads of RubberDuck VBA. Fortunately, the download numbers have been posted in chat, on a fairly regular basis, and in a fairly consistent format, so while I can't use SEDE for chat, I can use chat search. So, https://chat.stackexchange.com/search?q=Rubberduck.Setup. gets me the data I need....

But, the search results use inconsistent date formats, which means that I have to cleanse the data thoroughly, to use it.

  • If datestamps are today, I just get the time.

  • If datestamps are yesterday, I get yst and the time.

  • If datestamps are before yesterday and in this calendar week, then I get the abbreviated day name and the time.

  • If datestamps are before this calendar week and in this calendar year, then I get an abbreviated month name and a day of the month, and a time

  • If datestamps are before this calendar year, I get an abbreviated Month name, a day of the month, and an abbreviated year (with a leading apostrophe) and a time.

I'm in a locale that uses dd/MM/yyyy date formats, so even the date strings that look a bit like dates, aren't handled all that smoothly.

I understand that the "relative dates" are useful in a standard chat context, but I wonder whether a consistent ISO datetime (eg. YYYY-MM-DD HH:MM:SS) might be more useful in chat search results. It would certainly make doing my analysis easier, but it would undoubtedly help others use chat search as a pseudo SEDE for chat.

Maybe the date format is something that can be configured in search results, or user options?

And finally, for those interested, here is the download chart, based on the cleaned data...


1 Answer 1


I assumed I could quickly adapt an earlier hack of mine but it needed more adjustments so I baked this userscript. Until your feature request gets implemented you have a convenient way to get the data out and post-process it.

// ==UserScript==
// @name         List rubber duck
// @namespace    https://meta.stackexchange.com/users/158100/rene
// @version      0.1
// @description  export chat 
// @author       rene
// @match        *://chat.stackexchange.com/rooms/14929/*
// @grant        none
// ==/UserScript==

/* prettify hack  */
(function () {
    "use strict";

    var room = 14929,
        // Yes, month is zero based... day isn't :(
        // stop searching after ...
        date = new Date(2015, 7, 21), // 0 = Jan, 1 = Feb ... 11 = Dec
        userid = 90667, // Mat's Mug
        searchfor = 'Rubberduck.Setup.', // where are you searching for
        url = ['/chats', room, 'events'].join('/'),
        totalCount = 0,
        MS = 1000, // miliseconds
        baseYear = 1900,
        msgCountMax = 500,
        result = $('<div></div>');

    function loadEvents(before) {
        // data to post
        var data = {
            mode: 'Messages',
            before: before, // before this message id
            msgCount: msgCountMax, // we never get more ...
            fkey: fkey().fkey
        $.post(url, data).success(function (eve) {
            var i,
                next = true,
            for (i = 0; i < eve.events.length; i = i + 1) {
                event = eve.events[i];
                eventDate = new Date(event.time_stamp * MS);
                // time_stamp is now a real Date
                if (eventDate >= date) {
                    if (event.user_id === userid &&
                        event.content &&
                        event.content.indexOf(searchfor) > -1) {
                        // log all content!
                        console.log(eventDate.toISOString() + ' : ' +  event.content);
                        result.append($('<pre></pre>').text(eventDate.toISOString() + ' : ' +  event.content));
                } else {
                    // we reached our date...
                    // but keep processing....
                    next = false;
            if (next){
            } else {
                     $('<a href="#">Close</a>').on('click',function(e) {
        }).fail(function () {

    function start()
        // get the enddate full chat transscript
            room].join('/'), function (html) {
            var $messages = $(html).find('.message[id^="message-"]');
            // if those have messages ...
            if ($messages.length > 0) {
                // get the first message id to start loading events before that id
                loadEvents(parseInt($messages[0].id.replace('message-', ''), 10 /* base 10 */));
            } else {
                // 0 messages
                console.log('total messages: 0');

    function init()
        var p= $('#chat-buttons'),
            b = $('<button>').addClass('button').text('export');
        b.on('click', function(e) {
            .css('height',(window.screen.availHeight - 2 * 80).toString() + 'px');


The script is tested in Chrome with TamperMonkey.

When you run this in the chat room VBA-RubberDucking you'll get an extra button at the bottom, labeled Export. That will show a popup that is steadily filled while the chatroom events are retrieved and parsed. When ready you'll find the text done at the end of the popup and a link to Close it.

The result will look like this:

chatroom with export popup


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .