示例#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
示例#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
示例#3
0
文件: test.py 项目: takinai/football
    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
示例#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
示例#5
0
 def parse_page(self, response):
     """
     トピックスのページからタイトルと本文を抜き出す。
     """
     item = Headline()
     item['url'] = response.url
     item['html'] = response.text
     yield item
示例#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して、データを抽出する
示例#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して、データを抽出する。
示例#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
示例#9
0
文件: news.py 项目: taken10/scraping
 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