Vorspann


In [1]:
from dumptruck import DumpTruck
dt=DumpTruck(dbname="/home/martin/projekte/scribblelive/ipython/data/events.sqlite")
from cgi import escape
import types
import markdown
import re

def hstr(s) :
    if type(s) not in types.StringTypes :
        s=unicode(repr(s))
    s=unicode(s)
    s=re.sub(r"(http://([^/]+[^ ]+))",r'<a href="\1" target="_blank">\2</a>',escape(s))
    return s


styles=['#fbe1ca','#ffffff']

class HtmlLol :
    
    def __init__(self,o) :
        self.o=o
        
    def _repr_html_(self) :
        n=0
        res=u"<table>"
        res+=u"<tr><th>%s</th></tr>" % "</th><th>".join([hstr(a) for a in self.o[0]])
        for r in self.o[1:] :
            res+=u"<tr style='background-color: %s'><td>%s</td></tr>" % (styles[n % 2] ,u"</td><td>".join([hstr(a) for a in r]))
            n+=1
        res+=u"</table>"
        return res
            
        

def table(s) :
    res=dt.execute(s)
    top=[]
    top.append(res[0].keys())
    top.extend([a.values() for a in dt.execute(s)])
    t=HtmlLol(top)
    return(t)

Neueste Live Blogs (deutsch)


In [6]:
table("select numposts,id,title,strftime('%Y-%m-%d',lastmodified) as s,canonical,substr(who,2,50) as who from events where language = 'de' order by id desc, numposts desc limit 20")

Statistik nach Sprachen


In [7]:
table("select language,count(*) as num from events where numposts>0  group by language order by num desc")

Zeitverlauf: Deutsche Liveblogs


In [8]:
table("select language,count(*) as num,strftime('%Y-%m',start) as month from events where numposts>0 and language='de' group by language,month order by month desc")

Die letzten Tage


In [150]:
table("select count(*),max(id) as id,strftime('%Y-%m-%d',start) as day from events where start>'2013-08-01' and numposts>0  group by day order by day desc")


Out[150]:
count(*)idday
11765332013-10-03
11276722013-09-11
11754792013-09-09
371822532013-08-26
831819932013-08-25
1231810092013-08-24
1661800452013-08-23
1831792762013-08-22
1541784132013-08-21
1401767252013-08-20
1301759792013-08-19
881753132013-08-18
941750942013-08-17
1051741132013-08-16
1211721382013-08-15
1411716912013-08-14
1101703652013-08-13
1151690102013-08-12
651680792013-08-11
831669252013-08-10
1231659682013-08-09
1171654902013-08-08
1331644162013-08-07
1141639052013-08-06
831633912013-08-05
611628252013-08-04
631623052013-08-03
1191622762013-08-02
1161771502013-08-01

Top 10: Deutsche Liveblogs mit den meisten Kommentaren


In [198]:
table("select numposts,numcomments,title,canonical,who from events where language='de' order by numcomments desc limit 10")


Out[198]:

numposts

numcomments

title

canonical

who

3530

27222

Tatort Test

None

None

69

11725

DD_Rock am Ring Livestream

None

None

395

7788

UEFA Frauen EM 2013

None

["Meike Richter"]

3131

6879

Jetzt mitdiskutieren im EM-Talk

live.hr-online.de/Event/EM_der_Tag_live

["Redaktion sportschau.de", "Tom Klein", "Sven Nees", "michael.friedrich", "Redaktion sportschau.de", "Facebook-Kommentare"]

18

5547

Walulis sieht fern - Premiere Folge 4

None

None

473

4300

Rock im Park 2012

None

["on3_de"]

265

4079

Leichtathletik WM 2013

None

None

126

3997

24h Berlin live Blogging DE

www.scribblelive.com/Event/24h_Berlin_live_Blogging_DE

ARTE

693

3558

LateLine TV 23.5.

None

None

1182

3236

Sportschau: Wintersport im Ersten

None

None

Top 10: Längste Liveblogs (deutsch) nach Anzahl der Postings


In [204]:
table("select numposts,numcomments,title,canonical from events where language='de' order by numposts desc limit 10")


Out[204]:
numpostsnumcommentstitlecanonical
891377London Olympicswww.scribblelive.com/Event/London_Olympics
6632219iPhone 6 Keynotewww.scribblelive.com/Event/iPhone_6_Keynote
400100Tweets mit #RIPliveblog.br.de/Event/Tweets_mit_RIP
400030re:publica 2013 tweetsNone
300050Detox CHNone
241150#rar13None
1710915[Sandkasten] Test Event dpa Berlin 29. 5. 2013live.dtf12.de/Event/Test_Event_dpa_Berlin_29_5_2013
164532847Testwww.scribblelive.com/Event/Thread.aspx?Id=44954
156370#rarNone
13359458Studentenprotestwww.scribblelive.com/Event/Studentenprotest

Top 10: Syndizierte Liveblogs nach Anzahl der Postings


In [153]:
table("select numposts,title,canonical,issyndicated from events where issyndicated>0  order by numposts desc limit 10")


Out[153]:
numpoststitlecanonicalissyndicated
132161Prueba DTSNone1
108640Resassionhttp://changecamp.scribblelive.com/Event/Resassion1
106267Movember Charity Donationshttp://toronto.exceptional-results.com/Event/Movember_Charity_Donations1
84366Cricket Eventhttp://www.scribblelive.com/Event/Cricket_Event1
47751test p2http://liveblog.citytv.com/bachelor/Event/test_p21
42126SEC Twitter feeds http://espn.scribblelive.com/Event/SEC_Twitter_feeds1
41625JLo bbhttp://dev.scribblelive.com/LiveBlog/Event/JLo1
40694NCAA Tournament live blog and buzzNone1
40004AD Testhttp://demos.scribblelive.com/Event/AD_Test_21
40003Real Estate Agent Toronto: SYNDICATIONNone1

Top 10: White-Label-Liveblogs nach Anzahl der Kommentare


In [154]:
table("select numposts,canonical from events where numposts>0  and canonical != url order by numposts desc limit 10")


Out[154]:
numpostscanonical
35986http://directos.abc.es/Event/Actualidad_2
26037http://live.cbc.ca/Event/CBC_NL
18601http://live.blog.scribblelive.com/Event/The_ScribbleLive_Daily
18356http://endirect.radio-canada.ca/Event/Sport_en_direct
15139http://live.boston.com/Event/Country_Fest_at_Gillette_Stadium_Aug_23-24_--_reaction_from_the_show
3366http://directos.abc.es/Event/Galicia_ahora
3089http://directos.abc.es/Event/Actualidad_Madrid
1913http://live.philstar.com/Event/MaringUpdates
1812http://live.walesonline.co.uk/Event/Glamorgan_Cricket_Live
882http://live.1500espn.com/Event/Hubbard_Test_Event_Title

Die allerersten Liveblogs 2008


In [155]:
table("select start,language,canonical,title,numposts from events where numposts>0  order by start asc limit 4")


Out[155]:
startlanguagecanonicaltitlenumposts
datetime.datetime(1990, 10, 1, 7, 0)enNonetitle1
datetime.datetime(2008, 1, 19, 23, 32, 31)enhttp://www.scribblelive.com/Event/Thread.aspx?Id=12Test11
datetime.datetime(2008, 1, 20, 0, 5, 5)enhttp://www.scribblelive.com/Event/Thread.aspx?Id=13Test25
datetime.datetime(2008, 1, 20, 0, 45, 19)enhttp://www.scribblelive.com/Event/Thread.aspx?Id=15Test32

In [156]:
table("select max(id),min(id) from events")


Out[156]:
max(id)min(id)
1822531

Top 10: Liveblogs von T-Online nach Anzahl der Postings


In [205]:
table("select numposts,strftime('%Y-%m-%d',start) as start, canonical from events where canonical like '%reuters%' order by numposts desc limit 10")





In [12]:
"""
Demo of the histogram (hist) function with a few features.

In addition to the basic histogram, this demo shows a few optional features:

    * Setting the number of data bins
    * The ``normed`` flag, which normalizes bin heights so that the integral of
      the histogram is 1. The resulting histogram is a probability density.
    * Setting the face color of the bars
    * Setting the opacity (alpha value).

"""
import numpy as np
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt

x=[a["c"] for a in dt.execute("select numposts as c from events where numposts>10 and numposts<1000")]



num_bins = 50
# the histogram of the data
n, bins, patches = plt.hist(x, num_bins, facecolor='green', alpha=0.5)
# add a 'best fit' line
plt.xlabel('x')
plt.ylabel('y')
plt.title(r'Histogram')

# Tweak spacing to prevent clipping of ylabel
plt.subplots_adjust(left=0.15)
plt.show()



In [16]:
plt.plot([a["c"] for a in table("select count(*) as c ,strftime('%Y-%m-%d',start) as day from events where start>'2013-08-01' and numposts>0  group by day order by day desc").o])


---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-16-5fde6c9d5f39> in <module>()
----> 1 plt.plot([a["c"] for a in table("select count(*) as c ,strftime('%Y-%m-%d',start) as day from events where start>'2013-08-01' and numposts>0  group by day order by day desc").o])

TypeError: list indices must be integers, not str

In [ ]: