2015-07-06 94 views
0

我正在試圖從本網站menu items:使用下面的代碼到目標內該文中涉及的元素網頁抓取使用IPython的和LXML

http://new.holachef.com/daily_menus?menu_date=2015-07-06 

from urllib2 import urlopen 
from lxml.html import fromstring 

def get_page(url): 
    html = urlopen(url).read() 
    dom = fromstring(html) 
    dom.make_links_absolute(url) 
    return dom 

dom = get_page("http://new.holachef.com/daily_menus?menu_date=2015-07-06") 
dom.cssselect("#store_item_64419 > ul > li.meal-discription.clearfix > div.col-xs-8 > h2 > a") 
然而

我得到一個空輸出:

In [9]: dom.cssselect("#store_item_64419 > ul > li.meal-discription.clearfix > div.col-xs-8 > h2 > a") 
Out[9]: [] 

我想獲得那個文本<a>標記。

回答

0

我認爲你的腳本運行到這種模式,要求用戶選擇他們的位置。