def getOtherRecipeLinks(self):
"""Return a list of other recipes found in the page: while single recipe
pages do not have links, the various categories at
http://www.williams-sonoma.com/recipe/ do.
For example,
http://www.williams-sonoma.com/search/results.html?activeTab=recipes&words=winter_weeknight_dinners
has a collection of individual recipe links, and this method will find them.
"""
data = []
for link in self.tree.xpath('//ul[@class="recipe-list"]/li/a'):
if 'href' in link.keys():
href = urlsplit(link.get('href'))
if 'cm_src=RECIPESEARCH' == href.query:
data.append(href.scheme + '://' + href.netloc + href.path)
return data
评论列表
文章目录