-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfinance.py
More file actions
25 lines (20 loc) · 850 Bytes
/
Copy pathfinance.py
File metadata and controls
25 lines (20 loc) · 850 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# -*- coding: utf-8 -*-
import scrapy
from scrapy.linkextractors import LinkExtractor
from scrapy.spiders import CrawlSpider, Rule
class FinancePySpider(CrawlSpider):
name = 'finance.py'
allowed_domains = ['finance.yahoo.com']
start_urls = ['https://finance.yahoo.com/topic/stock-market-news/']
rules = (
Rule(LinkExtractor(allow=()), callback='parse_item', follow=True),
)
def parse_item(self, response):
#i = {}
yield{
'Title':response.xpath('//*[@id="Fin-Stream"]/ul/li/div/div/div[2]/h3/a/text()').getall()
}
#i['domain_id'] = response.xpath('//input[@id="sid"]/@value').extract()
#i['name'] = response.xpath('//div[@id="name"]').extract()
#i['description'] = response.xpath('//div[@id="description"]').extract()
#return