Exemple #1
0
 def parse_topics(self, response):
     item = Headline()
     item['title'] = response.css('head title::text').extract_first()
     item['body'] = " ".join(response.css('.o-article_block p')\
         .xpath('string()')\
         .extract())
     yield item
Exemple #2
0
 def parse_topics(self, response):
     """
     Scrape title and body-text
     """
     item = Headline()
     item['title'] = response.css('.newsTitle ::text').extract_first()
     item['body'] = response.css('.hbody').xpath('string()').extract_first()
     yield item
Exemple #3
0
    def parse_topics(self, response):
        item = Headline()
        item['title'] = response.css('.newsTitle ::text').extract_first()
        item['body'] = response.css('.hbody').xpath('string()').extract_first()
        yield item


# scrapy runspider xxx.py
Exemple #4
0
 def parse_topics(self, response):
     """
     トピックスのページからタイトルと本文を抜き出す。
     """
     item = Headline()
     item['title'] = response.css('.newsTitle ::text').extract_first()
     item['body'] = response.css('.hbody').xpath('string()').extract_first()
     yield item
Exemple #5
0
 def parse_page(self, response):
     """
     トピックスのページからタイトルと本文を抜き出す。
     """
     item = Headline()
     item['url'] = response.url
     item['html'] = response.text
     yield item
Exemple #6
0
 def parse_topics(self, response):
     """
     トピックスのページからタイトルと本文を抜き出す
     """
     item = Headline()  # Headlineオブジェクトを作成
     item['title'] = response.css(
         '.newsTitle ::text').extract_first()  # タイトル
     item['body'] = response.css('.hbody').xpath(
         'string()').extract_first()  # 本文
     yield item  # Itemをyieldして、データを抽出する
Exemple #7
0
 def parse_topics(self, response):
     """
     トピックスのページからタイトルと本文を抜き出す。
     """
     item = Headline()  # Headlineオブジェクトの作成。
     item['title'] = response.css(
         '.newsTitle ::text').extract_first()  # タイトル
     item['body'] = response.css('.hbody').xpath(
         'string()').extract_first()  # 本文
     #item['body'] = ''.join(response.css('.hbody ::text').extract()) # 本文 CSSセレクターのみを使う場合
     yield item  # Itemをyieldして、データを抽出する。
Exemple #8
0
 def parse_topics(self, response):
     """
     トピックスのページからタイトルと本文を抜き出す。
     """
     item = Headline()
     #item['title'] = response.css('.tpcNews_title::text').get()
     #item['body'] = response.css('.tpcNews_summary').xpath('string()').get()
     item['title'] = response.css(
         '.pickupMain_articleTitle::text').get()  # タイトル
     item['body'] = response.css('.pickupMain_articleSummary').xpath(
         'string()').get()  # 本文
     yield item
Exemple #9
0
 def parse_topics(self, response):
     item = Headline()
     item['title'] = response.css('.pickupMain_articleTitle ::text').extract_first()
     item['body'] = response.css('.pickupMain_articleSummary ::text').extract_first()
     yield item