6 with open('bloggers.yml') as f:
7 users = yaml.safe_load(f.read())
10 tree = html.fromstring(urllib2.urlopen(url).read())
12 '//link[@rel="alternate"][contains(@type, "rss") or ' +
13 'contains(@type, "atom") or contains(@type, "rdf")]')
14 candidates = [l for l in links if
15 'atom' in l.attrib['type'] and
16 'comments' not in l.attrib['href'].lower() and
17 'comments' not in l.attrib.get('title','')]
19 return candidates[0].attrib['href']
20 return links[0].attrib['href']
22 for (name, u) in users.items():
26 print " - %s:" % title.strip()
30 link = fetch_links(url)
31 if not link.startswith('http:'):
32 link = urlparse.urljoin(url, link)
36 with open('bloggers.yml', 'w') as f:
37 yaml.safe_dump(users, f)