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