Created
August 5, 2011 23:45
-
-
Save starenka/1128784 to your computer and use it in GitHub Desktop.
greps menus of my fav restaurants close to my office
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import datetime | |
from pyquery import PyQuery as pq | |
doc = pq(url='http://www.jinakrajina.cz/cz/poledni-menu') | |
noms = doc.find('td > p') | |
print '\n%s'%noms[0].text_content()[2:] | |
for i,nom in enumerate(noms[1:-1:2],1): | |
print '[%d] %s'%(i,nom.text_content().strip()) | |
print '\n=====\n' | |
doc = pq(url='http://www.lemonleaf.cz/lunch_buffet_menu.php') | |
noms = doc.find('div > dl')[datetime.date.today().weekday()].iterchildren() | |
for i in noms: | |
print i.text_content().strip(),noms.next().text_content().strip() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Novy BeautifulSoup tohle umi taky, ne? http://www.crummy.com/software/BeautifulSoup/bs4/doc/#css-selectors