summaryrefslogtreecommitdiff
path: root/dumps/_sites/second-a-lap.py
blob: 52591d61664ff58671db02ec2a07bc32b2cc3395 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import json
import urllib
import urllib2
import urlparse

from lxml import html

def fetch(url):
    url = urlparse.urlparse(url).path
    contents = json.loads(urllib2.urlopen('http://second-a-lap.blogspot.com/feeds/posts/default?' +
                          urllib.urlencode({'alt': 'json', 'v': 2, 'dynamicviews': 1, 'path': url})).read())
    title = contents['feed']['entry'][0]['title']['$t']
    text = contents['feed']['entry'][0]['content']['$t']
    tree = html.fromstring(text)
    tables = tree.xpath("//table[@bordercolor]")
    print url
    print title
    return title, tables