Commit 37b5fa54 authored by Vasyl Bodnaruk's avatar Vasyl Bodnaruk

Add searching tag on aitopics

parent d1419291
...@@ -68,8 +68,9 @@ class AitopSpider(BaseSpider): ...@@ -68,8 +68,9 @@ class AitopSpider(BaseSpider):
def build_items(self, response): def build_items(self, response):
try: try:
items = list() items = list()
rows = response.xpath(".//div[contains(@class, 'summaries')]//div[@class='row']") rows = response.xpath(".//div[contains(@class, 'summaries')]")
for i in rows: for r in rows:
i = r.xpath("//div[@class='row']")
item = ExaItem() item = ExaItem()
item['date'] = dateparser.parse(i.xpath(".//time/@datetime").extract_first()).replace(tzinfo=None) item['date'] = dateparser.parse(i.xpath(".//time/@datetime").extract_first()).replace(tzinfo=None)
item['title'] = ''.join(i.xpath(".//div[contains(@class, 'col-xs-12')]/h3/a//text()").extract()) item['title'] = ''.join(i.xpath(".//div[contains(@class, 'col-xs-12')]/h3/a//text()").extract())
...@@ -77,6 +78,8 @@ class AitopSpider(BaseSpider): ...@@ -77,6 +78,8 @@ class AitopSpider(BaseSpider):
item['url'] = i.xpath(".//div[contains(@class, 'col-xs-12')]/h3/a/@href").extract_first() item['url'] = i.xpath(".//div[contains(@class, 'col-xs-12')]/h3/a/@href").extract_first()
item.update(self.get_common_items(response.meta['company'])) item.update(self.get_common_items(response.meta['company']))
item['post_id'] = response.meta['post_id'] item['post_id'] = response.meta['post_id']
item['tags'] = r.xpath(".//div[@class='row hidden-xs']//div[@title='Concept Tags']//a[@class='filter btn btn-link']/text()").extract()
items.append(item) items.append(item)
return items return items
except: except:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment