daily pastebin goal
33%
SHARE
TWEET

Untitled

a guest Nov 23rd, 2017 45 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     def parse_article(self, response):
  2.         def extract_with_css(query):
  3.             result = response.css(query).extract_first().strip()
  4.             res = re.sub(r'<.*?>', '', result)
  5.             return res
  6.  
  7.         item = ScrapyArticlesItem()
  8.         item['name'] = extract_with_css('h1.post__title.post__title_full span::text')
  9.         item['article'] = extract_with_css('div.post__text.post__text-html.js-mediator-article')
  10.         yield item
RAW Paste Data
Top