Commit 7a0a722a authored by Vasyl Bodnaruk's avatar Vasyl Bodnaruk

Use function for get common item

parent 9bc38527
...@@ -82,6 +82,7 @@ class AitopSpider(QueryMixin, scrapy.Spider): ...@@ -82,6 +82,7 @@ class AitopSpider(QueryMixin, scrapy.Spider):
item['description'] = ''.join(i.xpath(".//div[@class='summary-content']/p/text()").extract()) item['description'] = ''.join(i.xpath(".//div[@class='summary-content']/p/text()").extract())
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']
items.append(item) items.append(item)
return items return items
except: except:
......
...@@ -35,10 +35,7 @@ class MobiHealthNewsSpider(QueryMixin, scrapy.Spider): ...@@ -35,10 +35,7 @@ class MobiHealthNewsSpider(QueryMixin, scrapy.Spider):
item['description'] = i.xpath(".//div[contains(@class, 'views-field views-field-body')]/span/text()").extract_first() item['description'] = i.xpath(".//div[contains(@class, 'views-field views-field-body')]/span/text()").extract_first()
item['url'] = 'http://www.mobihealthnews.com' + i.xpath(".//span/a/@href").extract_first() item['url'] = 'http://www.mobihealthnews.com' + i.xpath(".//span/a/@href").extract_first()
item['region_id'] = company.region_id item.update(self.get_common_items(company))
item['type_id'] = company.type_id
item['media_id'] = company.media_id
item['company_id'] = company.id
item['post_id'] = response.meta['post_id'] item['post_id'] = response.meta['post_id']
......
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