[fix] function parameters

This commit is contained in:
asciimoo 2014-01-30 02:36:05 +01:00
parent c6280966f5
commit 3dcb835910

View File

@ -37,7 +37,7 @@ def extract_text(xpath_results):
return html_to_text(xpath_results.text_content()) return html_to_text(xpath_results.text_content())
def extract_url(xpath_results, search_url=search_url): def extract_url(xpath_results, search_url):
url = extract_text(xpath_results) url = extract_text(xpath_results)
if url.startswith('//'): if url.startswith('//'):
@ -86,7 +86,7 @@ def response(resp):
dom = html.fromstring(resp.text) dom = html.fromstring(resp.text)
if results_xpath: if results_xpath:
for result in dom.xpath(results_xpath): for result in dom.xpath(results_xpath):
url = extract_url(result.xpath(url_xpath)) url = extract_url(result.xpath(url_xpath), search_url)
title = extract_text(result.xpath(title_xpath)[0]) title = extract_text(result.xpath(title_xpath)[0])
content = extract_text(result.xpath(content_xpath)[0]) content = extract_text(result.xpath(content_xpath)[0])
results.append({'url': url, 'title': title, 'content': content}) results.append({'url': url, 'title': title, 'content': content})