надо добавить еще ссылки именно на эти темы.
Возможно проще можно реализовать?)
Благодарю заранее за ответы.
#!/usr/bin/env python import urllib import re from bs4 import BeautifulSoup html = urllib.urlopen('http://habrahabr.ru') print "Scraping url: %s" % html.code bt = BeautifulSoup(html.read(), "lxml") print bt.title allLinks = bt.find_all('a') counter = 0 topX = 40 for item in allLinks: if (re.search('class="post_title"', str(item)) and (counter < topX)): print item.string counter = counter + 1