功能描述:

  技术路线:scrapy

  目标:获取上交所和深交所所有股票的名称和交易信息

  输出:保存到文件中

数据网站的确定

  获取股票列表:

    东方财富网:http://quote.eastmoney.com/stock_list.html

  获取个股信息:

    百度股票:https://gupiao.baidu.com/stock/

    单个股票:https://gupiao.baidu.com/stock/sz002439.html

步骤:

  步骤1:建立工程和Spider模板

D:\pycodes>scrapy startproject BaiduStocks
New Scrapy project 'BaiduStocks', using template directory 'd:\\users\\bj\\appdata\\local\\programs\\python\\python36\\lib\\site-packages\\scrapy\\templates\\project', created in:
D:\pycodes\BaiduStocks You can start your first spider with:
cd BaiduStocks
scrapy genspider example example.com D:\pycodes>cd BaiduStocks D:\pycodes\BaiduStocks>scrapy genspider stocks baidu.com
Created spider 'stocks' using template 'basic' in module:
BaiduStocks.spiders.stocks 进一步修改spiders/stocks.py文件

  步骤2:编写Spider

    配置stocks.py文件

    修改对返回页面的处理

    修改对新增URL爬取请求的处理

# -*- coding: utf-8 -*-
import scrapy
import re class StocksSpider(scrapy.Spider):
name = 'stocks'
start_urls = ['http://quote.eastmoney.com/stock_list.html'] def parse(self, response):
for href in response.css('a::attr(href)').extract():
try:
stock = re.findall(r"[s][hz]\d{6}",href)[0]
url = 'https://gupiao.baidu.com/stock/' + stock + '.html'
yield scrapy.Request(url,callback=self.parse_stock)#callback给出了处理这个url对应响应的处理函数,为了与当前页面的处理函数作区分,定义一个新的函数叫parse_stock
except:
continue def parse_stock(self, response):
infoDict = {}
stockInfo = response.css('.stock-bets')
name = stockInfo.css('.bets-name').extract()[0]
keyList = stockInfo.css('dt').extract()
valueList = stockInfo.css('dd').extract()
for i in range(len(keyList)):
key = re.findall(r'>.*</dt>', keyList[i])[0][1:-5]
try:
val = re.findall(r'\d+\.?.*</dd>', valueList[i])[0][0:-5]
except:
val = '--'
infoDict[key]=val
infoDict.update({'股票名称': re.findall('\s.*\(',name)[0].split()[0] + re.findall('\>.*\<', name)[0][1:-1]})
yield infoDict

  步骤3:编写Item Pipelines(对我们后期提取的数据做相关的处理)

    配置pipelines.py文件

    定义对爬取项(Scraped Item)的处理类

      pipelines.py这里面的每一个类都是对一个item进行处理的一个过程

      尝试新定义一个类,通过配置文件让框架找到新定义的类,并且用这个类来处理spider提取的相关的item类的信息

# -*- coding: utf-8 -*-

# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html class BaidustocksPipeline(object):
def process_item(self, item, spider):
return item class BaidustocksInfoPipeline(object):
def open_spider(self,spider):#指的是当一个爬虫被调用时,对应的pipeline启动的方法
self.f = open('BaiduStockInfo.txt','w')
def close_spider(self,spider):#指的是一个爬虫关闭时或结束时,pipeline对应的方法
self.f.close()
def process_item(self,item,spider):#对每一个item项进行处理时,对应的方法,也是pipeline中最主体的函数
try:
line = str(dict(item)) + '\n'
self.f.write(line)
except:
pass
return item

    配置ITEM_PIPELLINES选项 修改配置文件settings.py

配置前

股票数据Scrapy爬虫-LMLPHP

配置后

股票数据Scrapy爬虫-LMLPHP

在ITEM_PIPELLINES里将自己定义BaidustockInfoPipeline写到其中

# -*- coding: utf-8 -*-

# Scrapy settings for BaiduStocks project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# https://doc.scrapy.org/en/latest/topics/settings.html
# https://doc.scrapy.org/en/latest/topics/downloader-middleware.html
# https://doc.scrapy.org/en/latest/topics/spider-middleware.html BOT_NAME = 'BaiduStocks' SPIDER_MODULES = ['BaiduStocks.spiders']
NEWSPIDER_MODULE = 'BaiduStocks.spiders' # Crawl responsibly by identifying yourself (and your website) on the user-agent
#USER_AGENT = 'BaiduStocks (+http://www.yourdomain.com)' # Obey robots.txt rules
ROBOTSTXT_OBEY = True # Configure maximum concurrent requests performed by Scrapy (default: 16)
#CONCURRENT_REQUESTS = 32 # Configure a delay for requests for the same website (default: 0)
# See https://doc.scrapy.org/en/latest/topics/settings.html#download-delay
# See also autothrottle settings and docs
#DOWNLOAD_DELAY = 3
# The download delay setting will honor only one of:
#CONCURRENT_REQUESTS_PER_DOMAIN = 16
#CONCURRENT_REQUESTS_PER_IP = 16 # Disable cookies (enabled by default)
#COOKIES_ENABLED = False # Disable Telnet Console (enabled by default)
#TELNETCONSOLE_ENABLED = False # Override the default request headers:
#DEFAULT_REQUEST_HEADERS = {
# 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
# 'Accept-Language': 'en',
#} # Enable or disable spider middlewares
# See https://doc.scrapy.org/en/latest/topics/spider-middleware.html
#SPIDER_MIDDLEWARES = {
# 'BaiduStocks.middlewares.BaidustocksSpiderMiddleware': 543,
#} # Enable or disable downloader middlewares
# See https://doc.scrapy.org/en/latest/topics/downloader-middleware.html
#DOWNLOADER_MIDDLEWARES = {
# 'BaiduStocks.middlewares.BaidustocksDownloaderMiddleware': 543,
#} # Enable or disable extensions
# See https://doc.scrapy.org/en/latest/topics/extensions.html
#EXTENSIONS = {
# 'scrapy.extensions.telnet.TelnetConsole': None,
#} # Configure item pipelines
# See https://doc.scrapy.org/en/latest/topics/item-pipeline.html
ITEM_PIPELINES = {
'BaiduStocks.pipelines.BaidustocksInfoPipeline': 300,
} # Enable and configure the AutoThrottle extension (disabled by default)
# See https://doc.scrapy.org/en/latest/topics/autothrottle.html
#AUTOTHROTTLE_ENABLED = True
# The initial download delay
#AUTOTHROTTLE_START_DELAY = 5
# The maximum download delay to be set in case of high latencies
#AUTOTHROTTLE_MAX_DELAY = 60
# The average number of requests Scrapy should be sending in parallel to
# each remote server
#AUTOTHROTTLE_TARGET_CONCURRENCY = 1.0
# Enable showing throttling stats for every response received:
#AUTOTHROTTLE_DEBUG = False # Enable and configure HTTP caching (disabled by default)
# See https://doc.scrapy.org/en/latest/topics/downloader-middleware.html#httpcache-middleware-settings
#HTTPCACHE_ENABLED = True
#HTTPCACHE_EXPIRATION_SECS = 0
#HTTPCACHE_DIR = 'httpcache'
#HTTPCACHE_IGNORE_HTTP_CODES = []
#HTTPCACHE_STORAGE = 'scrapy.extensions.httpcache.FilesystemCacheStorage'

综述

生成了一个spider,它能够从东方财富网获得股票的列表并且针对每一个股票列表生成一个百度股票的链接,并向这个百度股票的链接进行信息爬取,对于爬取后的信息,经过spider的处理,我们提取出其中的关键信息,形成字典,并且将这个字典以item类的形式给到了item pipelines进行后续处理

执行程序scrapy crawl stocks

优化

优化目的:进一步提高scrapy爬虫的爬取速度,想提高爬取速度,要依靠scrapy框架提供的相关的参数

scrapy框架一共提供了四个与性能相关的配置参数,这四个都与并发连接有关系

股票数据Scrapy爬虫-LMLPHP

优化后完整代码:

settings.py

# -*- coding: utf-8 -*-

# Scrapy settings for BaiduStocks project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# https://doc.scrapy.org/en/latest/topics/settings.html
# https://doc.scrapy.org/en/latest/topics/downloader-middleware.html
# https://doc.scrapy.org/en/latest/topics/spider-middleware.html BOT_NAME = 'BaiduStocks' SPIDER_MODULES = ['BaiduStocks.spiders']
NEWSPIDER_MODULE = 'BaiduStocks.spiders' # Crawl responsibly by identifying yourself (and your website) on the user-agent
# USER_AGENT = 'BaiduStocks (+http://www.yourdomain.com)' #修改是否遵守爬虫协议为False
# Obey robots.txt rules
ROBOTSTXT_OBEY = False #修改并发请求数,修改为1,或者2,越小爬取速度越慢,太快容易被识别到
# Configure maximum concurrent requests performed by Scrapy (default: 16)
CONCURRENT_REQUESTS = 1 # Configure a delay for requests for the same website (default: 0)
# See https://doc.scrapy.org/en/latest/topics/settings.html#download-delay
# See also autothrottle settings and docs
#修改下载延迟时间,DOWNLOAD_DELAY设置越大请求越慢
DOWNLOAD_DELAY = 6
# The download delay setting will honor only one of:
#CONCURRENT_REQUESTS_PER_DOMAIN = 16
#CONCURRENT_REQUESTS_PER_IP = 16 # Disable cookies (enabled by default)
#COOKIES_ENABLED = False # Disable Telnet Console (enabled by default)
#TELNETCONSOLE_ENABLED = False # Override the default request headers:
#DEFAULT_REQUEST_HEADERS = {
# 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
# 'Accept-Language': 'en',
#} # Enable or disable spider middlewares
# See https://doc.scrapy.org/en/latest/topics/spider-middleware.html
#SPIDER_MIDDLEWARES = {
# 'BaiduStocks.middlewares.BaidustocksSpiderMiddleware': 543,
#} # Enable or disable downloader middlewares
# See https://doc.scrapy.org/en/latest/topics/downloader-middleware.html
#开启中间键
DOWNLOADER_MIDDLEWARES = {
'BaiduStocks.middlewares.BaidustocksDownloaderMiddleware': 543,
'scrapy.downloadermiddleware.useragent.UserAgentMiddleware': None,
'BaiduStocks.middlewares.RandomUserAgentMiddleware': 400,
} # Enable or disable extensions
# See https://doc.scrapy.org/en/latest/topics/extensions.html
#EXTENSIONS = {
# 'scrapy.extensions.telnet.TelnetConsole': None,
#} # Configure item pipelines
# See https://doc.scrapy.org/en/latest/topics/item-pipeline.html
#开启PIPELINES,一般在要存储数据的时候开启
ITEM_PIPELINES = {
'BaiduStocks.pipelines.BaidustocksInfoPipeline': 300,
} # Enable and configure the AutoThrottle extension (disabled by default)
# See https://doc.scrapy.org/en/latest/topics/autothrottle.html
##默认False;为True表示启用AUTOTHROTTLE扩展
AUTOTHROTTLE_ENABLED = True
# The initial download delay
##默认5秒;初始下载延迟时间
AUTOTHROTTLE_START_DELAY = 1
# The maximum download delay to be set in case of high latencies
#默认60秒;在高延迟情况下最大的下载延迟
AUTOTHROTTLE_MAX_DELAY = 3
# The average number of requests Scrapy should be sending in parallel to
# each remote server
#AUTOTHROTTLE_TARGET_CONCURRENCY = 1.0
# Enable showing throttling stats for every response received:
#AUTOTHROTTLE_DEBUG = False # Enable and configure HTTP caching (disabled by default)
# See https://doc.scrapy.org/en/latest/topics/downloader-middleware.html#httpcache-middleware-settings
#开启本地缓存
HTTPCACHE_ENABLED = True
#将http缓存延迟时间
HTTPCACHE_EXPIRATION_SECS = 1
HTTPCACHE_DIR = 'httpcache'
HTTPCACHE_IGNORE_HTTP_CODES = []
HTTPCACHE_STORAGE = 'scrapy.extensions.httpcache.FilesystemCacheStorage'

stocks.py

# -*- coding: utf-8 -*-
import scrapy
import re class StocksSpider(scrapy.Spider):
name = 'stocks'
start_urls = ['http://quote.eastmoney.com/stock_list.html'] def parse(self, response):
# print(response.request.headers['User-Agent'])
for href in response.css('a::attr(href)').extract():
try:
stock = re.findall(r"[s][hz]\d{6}",href)[0]
url = 'https://gupiao.baidu.com/stock/' + stock + '.html'
yield scrapy.Request(url,callback=self.parse_stock)#callback给出了处理这个url对应响应的处理函数,为了与当前页面的处理函数作区分,定义一个新的函数叫parse_stock
except:
continue def parse_stock(self, response):
# print(response.request.headers['User-Agent'])
infoDict = {}
stockInfo = response.css('.stock-bets')
name = stockInfo.css('.bets-name').extract()[0]
keyList = stockInfo.css('dt').extract()
valueList = stockInfo.css('dd').extract()
for i in range(len(keyList)):
key = re.findall(r'>.*</dt>', keyList[i])[0][1:-5]
try:
val = re.findall(r'\d+\.?.*</dd>', valueList[i])[0][0:-5]
except:
val = '--'
infoDict[key]=val
infoDict.update({'股票名称': re.findall('\s.*\(',name)[0].split()[0] + re.findall('\>.*\<', name)[0][1:-1]})
yield infoDict

pipelines.py

# -*- coding: utf-8 -*-

# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html class BaidustocksPipeline(object):
def process_item(self, item, spider):
return item class BaidustocksInfoPipeline(object):
def open_spider(self,spider):#指的是当一个爬虫被调用时,对应的pipeline启动的方法
self.f = open('BaiduStockInfo.txt','w')
def close_spider(self,spider):#指的是一个爬虫关闭时或结束时,pipeline对应的方法
self.f.close()
def process_item(self,item,spider):#对每一个item项进行处理时,对应的方法,也是pipeline中最主体的函数
try:
line = str(dict(item)) + '\n'
self.f.write(line)
except:
pass
return item

middlewares.py

# -*- coding: utf-8 -*-

# Define here the models for your spider middleware
#
# See documentation in:
# https://doc.scrapy.org/en/latest/topics/spider-middleware.html from scrapy import signals import random
from fake_useragent import UserAgent
from scrapy.downloadermiddlewares.useragent import UserAgentMiddleware class BaidustocksSpiderMiddleware(object):
# Not all methods need to be defined. If a method is not defined,
# scrapy acts as if the spider middleware does not modify the
# passed objects. @classmethod
def from_crawler(cls, crawler):
# This method is used by Scrapy to create your spiders.
s = cls()
crawler.signals.connect(s.spider_opened, signal=signals.spider_opened)
return s def process_spider_input(self, response, spider):
# Called for each response that goes through the spider
# middleware and into the spider. # Should return None or raise an exception.
return None def process_spider_output(self, response, result, spider):
# Called with the results returned from the Spider, after
# it has processed the response. # Must return an iterable of Request, dict or Item objects.
for i in result:
yield i def process_spider_exception(self, response, exception, spider):
# Called when a spider or process_spider_input() method
# (from other spider middleware) raises an exception. # Should return either None or an iterable of Response, dict
# or Item objects.
pass def process_start_requests(self, start_requests, spider):
# Called with the start requests of the spider, and works
# similarly to the process_spider_output() method, except
# that it doesn’t have a response associated. # Must return only requests (not items).
for r in start_requests:
yield r def spider_opened(self, spider):
spider.logger.info('Spider opened: %s' % spider.name) class BaidustocksDownloaderMiddleware(object):
# Not all methods need to be defined. If a method is not defined,
# scrapy acts as if the downloader middleware does not modify the
# passed objects. @classmethod
def from_crawler(cls, crawler):
# This method is used by Scrapy to create your spiders.
s = cls()
crawler.signals.connect(s.spider_opened, signal=signals.spider_opened)
return s def process_request(self, request, spider):
# Called for each request that goes through the downloader
# middleware. # Must either:
# - return None: continue processing this request
# - or return a Response object
# - or return a Request object
# - or raise IgnoreRequest: process_exception() methods of
# installed downloader middleware will be called
return None def process_response(self, request, response, spider):
# Called with the response returned from the downloader. # Must either;
# - return a Response object
# - return a Request object
# - or raise IgnoreRequest
return response def process_exception(self, request, exception, spider):
# Called when a download handler or a process_request()
# (from other downloader middleware) raises an exception. # Must either:
# - return None: continue processing this exception
# - return a Response object: stops process_exception() chain
# - return a Request object: stops process_exception() chain
pass def spider_opened(self, spider):
spider.logger.info('Spider opened: %s' % spider.name) class RandomUserAgentMiddleware(UserAgentMiddleware): def __init__(self):
self.agent = UserAgent() @classmethod
def from_crawler(cls, crawler):
return cls() def process_request(self, request, spider):
request.headers.setdefault('User-Agent', self.agent.random)

写入文件后的文件内容

BaiduStockInfo.txt

{'今开': '13.41', '成交量': '159.61万手', '最高': '13.52', '涨停': '14.39', '内盘': '92.20万手', '成交额': '21.34亿', '委比': '16.67%', '流通市值': '720.19亿', '市盈率<sup>MRQ</sup>': '51.09', '每股收益': '0.13', '总股本': '67.16亿', '昨收': '13.08', '换手率': '2.94%', '最低': '13.23', '跌停': '11.77', '外盘': '83.25万手', '振幅': '2.22%', '量比': '3.70', '总市值': '889.82亿', '市净率': '4.40', '每股净资产': '3.01', '流通股本': '54.35亿', '股票名称': '东方财富300059'}
{'最高': '1.08', '最低': '1.07', '今开': '1.07', '昨收': '1.06', '成交额': '1.52万', '成交量': '142手', '净值': '1.0574', '折价率': '1.76', '股票名称': '香港小盘A161124'}
{'今开': '69.52', '成交量': '4.49万手', '最高': '73.13', '涨停': '75.79', '内盘': '2.15万手', '成交额': '3.23亿', '委比': '52.04%', '流通市值': '30.19亿', '市盈率<sup>MRQ</sup>': '69.24', '每股收益': '0.26', '总股本': '4.04亿', '昨收': '68.90', '换手率': '10.88%', '最低': '69.50', '跌停': '62.01', '外盘': '2.82万手', '振幅': '5.27%', '量比': '--', '总市值': '295.36亿', '市净率': '5.46', '每股净资产': '13.38', '流通股本': '4128.00万', '股票名称': '立华股份300761'}
{'今开': '157.30', '成交量': '2.00万手', '最高': '161.65', '涨停': '171.46', '内盘': '8650手', '成交额': '3.19亿', '委比': '3.23%', '流通市值': '194.56亿', '市盈率<sup>MRQ</sup>': '48.35', '每股收益': '0.83', '总股本': '12.16亿', '昨收': '155.87', '换手率': '1.64%', '最低': '155.00', '跌停': '140.28', '外盘': '1.25万手', '振幅': '4.27%', '量比': '--', '总市值': '1945.11亿', '市净率': '12.04', '每股净资产': '13.29', '流通股本': '1.22亿', '股票名称': '迈瑞医疗300760'}
{'今开': '28.70', '成交量': '5652手', '最高': '28.94', '涨停': '31.41', '内盘': '3076手', '成交额': '1627.31万', '委比': '5.45%', '流通市值': '7.66亿', '市盈率<sup>MRQ</sup>': '49.99', '每股收益': '0.14', '总股本': '1.07亿', '昨收': '28.55', '换手率': '2.12%', '最低': '28.64', '跌停': '25.69', '外盘': '2892手', '振幅': '1.05%', '量比': '--', '总市值': '30.64亿', '市净率': '2.85', '每股净资产': '10.07', '流通股本': '2668.00万', '股票名称': '七彩化学300758'}
{'今开': '27.93', '成交量': '1.32万手', '最高': '29.26', '涨停': '31.02', '内盘': '6720手', '成交额': '3772.23万', '委比': '31.37%', '流通市值': '7.50亿', '市盈率<sup>MRQ</sup>': '119.36', '每股收益': '0.08', '总股本': '1.04亿', '昨收': '28.20', '换手率': '5.08%', '最低': '27.81', '跌停': '25.38', '外盘': '7117手', '振幅': '5.14%', '量比': '--', '总市值': '30.00亿', '市净率': '3.43', '每股净资产': '8.42', '流通股本': '2600.00万', '股票名称': '罗博特科300757'}
{'今开': '33.60', '成交量': '4605手', '最高': '34.33', '涨停': '36.96', '内盘': '2694手', '成交额': '1561.69万', '委比': '31.00%', '流通市值': '6.09亿', '市盈率<sup>MRQ</sup>': '44.76', '每股收益': '0.34', '总股本': '7200.00万', '昨收': '33.60', '换手率': '2.56%', '最低': '33.56', '跌停': '30.24', '外盘': '2003手', '振幅': '2.29%', '量比': '--', '总市值': '24.38亿', '市净率': '1.37', '每股净资产': '24.73', '流通股本': '1800.00万', '股票名称': '中山金马300756'}
{'今开': '35.05', '成交量': '2.28万手', '最高': '35.23', '涨停': '38.36', '内盘': '1.44万手', '成交额': '7877.90万', '委比': '7.59%', '流通市值': '20.06亿', '市盈率<sup>MRQ</sup>': '22.63', '每股收益': '0.38', '总股本': '2.32亿', '昨收': '34.87', '换手率': '3.93%', '最低': '34.24', '跌停': '31.38', '外盘': '9764手', '振幅': '2.84%', '量比': '--', '总市值': '80.26亿', '市净率': '3.45', '每股净资产': '10.05', '流通股本': '5788.87万', '股票名称': '华致酒行300755'}
{'今开': '35.00', '成交量': '1.17万手', '最高': '35.88', '涨停': '38.43', '内盘': '5502手', '成交额': '4147.56万', '委比': '34.08%', '流通市值': '7.20亿', '市盈率<sup>MRQ</sup>': '47.18', '每股收益': '0.19', '总股本': '8080.00万', '昨收': '34.94', '换手率': '5.78%', '最低': '34.89', '跌停': '31.45', '外盘': '7040手', '振幅': '2.83%', '量比': '--', '总市值': '28.78亿', '市净率': '4.64', '每股净资产': '7.67', '流通股本': '2020.00万', '股票名称': '爱朋医疗300753'}
{'今开': '29.88', '成交量': '5.55万手', '最高': '30.49', '涨停': '34.87', '内盘': '3.54万手', '成交额': '1.67亿', '委比': '12.44%', '流通市值': '8.62亿', '市盈率<sup>MRQ</sup>': '29.72', '每股收益': '0.40', '总股本': '1.16亿', '昨收': '31.70', '换手率': '19.11%', '最低': '29.61', '跌停': '28.53', '外盘': '2.45万手', '振幅': '2.78%', '量比': '--', '总市值': '34.47亿', '市净率': '2.60', '每股净资产': '11.39', '流通股本': '2906.45万', '股票名称': '隆利科技300752'}
{'今开': '143.76', '成交量': '6559手', '最高': '143.76', '涨停': '156.59', '内盘': '4200手', '成交额': '9206.52万', '委比': '76.86%', '流通市值': '18.12亿', '市盈率<sup>MRQ</sup>': '28.52', '每股收益': '1.22', '总股本': '5200.00万', '昨收': '142.35', '换手率': '5.05%', '最低': '138.11', '跌停': '128.12', '外盘': '2635手', '振幅': '3.97%', '量比': '--', '总市值': '72.49亿', '市净率': '6.20', '每股净资产': '22.47', '流通股本': '1300.00万', '股票名称': '迈为股份300751'}
{'今开': '74.00', '成交量': '3.84万手', '最高': '74.18', '涨停': '80.66', '内盘': '2.28万手', '成交额': '2.81亿', '委比': '0.47%', '流通市值': '874.69亿', '市盈率<sup>MRQ</sup>': '38.28', '每股收益': '0.48', '总股本': '21.94亿', '昨收': '73.33', '换手率': '0.32%', '最低': '72.80', '跌停': '66.00', '外盘': '1.86万手', '振幅': '1.88%', '量比': '--', '总市值': '1603.48亿', '市净率': '4.69', '每股净资产': '15.59', '流通股本': '11.97亿', '股票名称': '宁德时代300750'}
{'今开': '12.46', '成交量': '1.90万手', '最高': '12.59', '涨停': '13.72', '内盘': '1.17万手', '成交额': '2370.88万', '委比': '10.98%', '流通市值': '6.32亿', '市盈率<sup>MRQ</sup>': '--', '每股收益': '0.01', '总股本': '2.05亿', '昨收': '12.47', '换手率': '3.71%', '最低': '12.30', '跌停': '11.22', '外盘': '8044手', '振幅': '2.33%', '量比': '--', '总市值': '25.26亿', '市净率': '1.90', '每股净资产': '6.48', '流通股本': '5130.00万', '股票名称': '顶固集创300749'}
{'今开': '69.00', '成交量': '21.33万手', '最高': '71.50', '涨停': '71.75', '内盘': '11.49万手', '成交额': '14.08亿', '委比': '4.44%', '流通市值': '27.48亿', '市盈率<sup>MRQ</sup>': '231.79', '每股收益': '0.14', '总股本': '4.13亿', '昨收': '65.23', '换手率': '51.26%', '最低': '60.66', '跌停': '58.71', '外盘': '11.84万手', '振幅': '16.62%', '量比': '--', '总市值': '273.07亿', '市净率': '24.27', '每股净资产': '2.72', '流通股本': '4160.00万', '股票名称': '金力永磁300748'}
{'今开': '131.12', '成交量': '5412手', '最高': '133.30', '涨停': '143.22', '内盘': '2627手', '成交额': '7139.16万', '委比': '55.17%', '流通市值': '86.07亿', '市盈率<sup>MRQ</sup>': '41.81', '每股收益': '0.78', '总股本': '1.28亿', '昨收': '130.20', '换手率': '0.83%', '最低': '130.66', '跌停': '117.18', '外盘': '3099手', '振幅': '2.03%', '量比': '--', '总市值': '167.94亿', '市净率': '7.87', '每股净资产': '16.68', '流通股本': '6560.54万', '股票名称': '锐科激光300747'}
{'今开': '14.27', '成交量': '8823手', '最高': '14.29', '涨停': '15.50', '内盘': '5261手', '成交额': '1245.83万', '委比': '24.24%', '流通市值': '8.89亿', '市盈率<sup>MRQ</sup>': '53.41', '每股收益': '0.07', '总股本': '2.10亿', '昨收': '14.09', '换手率': '1.40%', '最低': '14.06', '跌停': '12.68', '外盘': '3757手', '振幅': '1.63%', '量比': '--', '总市值': '29.67亿', '市净率': '3.20', '每股净资产': '4.40', '流通股本': '6302.50万', '股票名称': '汉嘉设计300746'}
{'今开': '29.00', '成交量': '12.60万手', '最高': '30.37', '涨停': '30.37', '内盘': '7.53万手', '成交额': '3.59亿', '委比': '20.00%', '流通市值': '15.58亿', '市盈率<sup>MRQ</sup>': '48.94', '每股收益': '0.14', '总股本': '1.15亿', '昨收': '27.61', '换手率': '21.59%', '最低': '26.22', '跌停': '24.85', '外盘': '5.85万手', '振幅': '15.03%', '量比': '--', '总市值': '30.57亿', '市净率': '2.79', '每股净资产': '9.56', '流通股本': '5833.62万', '股票名称': '欣锐科技300745'}
{'今开': '20.00', '成交量': '1.34万手', '最高': '20.39', '涨停': '22.02', '内盘': '8718手', '成交额': '2690.66万', '委比': '69.63%', '流通市值': '10.93亿', '市盈率<sup>MRQ</sup>': '71.50', '每股收益': '0.10', '总股本': '9815.70万', '昨收': '20.02', '换手率': '2.46%', '最低': '19.93', '跌停': '18.02', '外盘': '5567手', '振幅': '2.30%', '量比': '--', '总市值': '19.64亿', '市净率': '3.34', '每股净资产': '5.98', '流通股本': '5461.75万', '股票名称': '天地数码300743'}
{'今开': '28.15', '成交量': '1.38万手', '最高': '28.59', '涨停': '30.55', '内盘': '7467手', '成交额': '3827.03万', '委比': '1.13%', '流通市值': '11.69亿', '市盈率<sup>MRQ</sup>': '--', '每股收益': '0.20', '总股本': '7849.86万', '昨收': '27.77', '换手率': '3.20%', '最低': '27.17', '跌停': '24.99', '外盘': '7017手', '振幅': '5.11%', '量比': '--', '总市值': '21.35亿', '市净率': '1.91', '每股净资产': '14.21', '流通股本': '4296.08万', '股票名称': '越博动力300742'}
{'今开': '29.24', '成交量': '7918手', '最高': '29.62', '涨停': '32.26', '内盘': '4740手', '成交额': '2309.10万', '委比': '63.07%', '流通市值': '17.94亿', '市盈率<sup>MRQ</sup>': '15.29', '每股收益': '0.48', '总股本': '6.16亿', '昨收': '29.33', '换手率': '1.29%', '最低': '28.91', '跌停': '26.40', '外盘': '3677手', '振幅': '2.42%', '量比': '--', '总市值': '179.41亿', '市净率': '1.94', '每股净资产': '15.05', '流通股本': '6159.00万', '股票名称': '华宝股份300741'}
{'今开': '8.90', '成交量': '7.37万手', '最高': '9.02', '涨停': '9.89', '内盘': '5.05万手', '成交额': '6525.54万', '委比': '70.56%', '流通市值': '19.63亿', '市盈率<sup>MRQ</sup>': '1985.98', '每股收益': '0.00', '总股本': '4.11亿', '昨收': '8.99', '换手率': '3.30%', '最低': '8.66', '跌停': '8.09', '外盘': '3.02万手', '振幅': '4.00%', '量比': '--', '总市值': '36.10亿', '市净率': '1.71', '每股净资产': '5.14', '流通股本': '2.24亿', '股票名称': '御家汇300740'}
{'今开': '17.73', '成交量': '8.49万手', '最高': '18.29', '涨停': '19.36', '内盘': '4.14万手', '成交额': '1.53亿', '委比': '49.18%', '流通市值': '12.64亿', '市盈率<sup>MRQ</sup>': '46.33', '每股收益': '0.15', '总股本': '2.77亿', '昨收': '17.60', '换手率': '12.26%', '最低': '17.50', '跌停': '15.84', '外盘': '4.86万手', '振幅': '4.49%', '量比': '--', '总市值': '50.56亿', '市净率': '2.64', '每股净资产': '6.92', '流通股本': '6930.00万', '股票名称': '明阳电路300739'}
{'今开': '30.50', '成交量': '1.53万手', '最高': '30.77', '涨停': '33.33', '内盘': '9266手', '成交额': '4673.82万', '委比': '26.55%', '流通市值': '18.36亿', '市盈率<sup>MRQ</sup>': '62.87', '每股收益': '0.22', '总股本': '1.17亿', '昨收': '30.30', '换手率': '2.55%', '最低': '30.21', '跌停': '27.27', '外盘': '7315手', '振幅': '1.85%', '量比': '--', '总市值': '35.80亿', '市净率': '3.40', '每股净资产': '8.95', '流通股本': '6025.68万', '股票名称': '奥飞数据300738'}
{'今开': '8.88', '成交量': '1.39万手', '最高': '9.02', '涨停': '9.77', '内盘': '7062手', '成交额': '1247.56万', '委比': '14.69%', '流通市值': '24.75亿', '市盈率<sup>MRQ</sup>': '32.41', '每股收益': '0.07', '总股本': '6.08亿', '昨收': '8.88', '换手率': '0.50%', '最低': '8.88', '跌停': '7.99', '外盘': '7194手', '振幅': '1.58%', '量比': '--', '总市值': '54.39亿', '市净率': '1.85', '每股净资产': '4.84', '流通股本': '2.77亿', '股票名称': '科顺股份300737'}
{'今开': '10.94', '成交量': '2.11万手', '最高': '11.00', '涨停': '11.91', '内盘': '1.02万手', '成交额': '2295.59万', '委比': '3.48%', '流通市值': '8.68亿', '市盈率<sup>MRQ</sup>': '--', '每股收益': '0.06', '总股本': '1.31亿', '昨收': '10.83', '换手率': '2.64%', '最低': '10.81', '跌停': '9.75', '外盘': '1.13万手', '振幅': '1.75%', '量比': '--', '总市值': '14.18亿', '市净率': '2.22', '每股净资产': '4.88', '流通股本': '7997.74万', '股票名称': '百邦科技300736'}
{'今开': '24.16', '成交量': '18.36万手', '最高': '24.90', '涨停': '26.73', '内盘': '9.92万手', '成交额': '4.47亿', '委比': '49.97%', '流通市值': '40.56亿', '市盈率<sup>MRQ</sup>': '34.35', '每股收益': '0.23', '总股本': '4.61亿', '昨收': '24.30', '换手率': '11.07%', '最低': '23.81', '跌停': '21.87', '外盘': '9.88万手', '振幅': '4.49%', '量比': '--', '总市值': '112.78亿', '市净率': '4.58', '每股净资产': '5.34', '流通股本': '1.66亿', '股票名称': '光弘科技300735'}
{'今开': '10.96', '成交量': '6384手', '最高': '11.11', '涨停': '11.98', '内盘': '2701手', '成交额': '704.00万', '委比': '37.23%', '流通市值': '7.46亿', '市盈率<sup>MRQ</sup>': '51.52', '每股收益': '0.05', '总股本': '1.60亿', '昨收': '10.89', '换手率': '0.94%', '最低': '10.90', '跌停': '9.80', '外盘': '3863手', '振幅': '1.93%', '量比': '--', '总市值': '17.60亿', '市净率': '1.53', '每股净资产': '7.17', '流通股本': '6783.75万', '股票名称': '西菱动力300733'}
{'今开': '16.70', '成交量': '7712手', '最高': '16.76', '涨停': '18.22', '内盘': '3942手', '成交额': '1286.50万', '委比': '22.77%', '流通市值': '19.67亿', '市盈率<sup>MRQ</sup>': '17.14', '每股收益': '0.34', '总股本': '1.92亿', '昨收': '16.56', '换手率': '0.65%', '最低': '16.60', '跌停': '14.90', '外盘': '4004手', '振幅': '0.97%', '量比': '--', '总市值': '31.97亿', '市净率': '1.07', '每股净资产': '15.58', '流通股本': '1.18亿', '股票名称': '设研院300732'}
{'今开': '20.19', '成交量': '5.61万手', '最高': '20.74', '涨停': '22.24', '内盘': '2.92万手', '成交额': '1.14亿', '委比': '42.59%', '流通市值': '17.03亿', '市盈率<sup>MRQ</sup>': '51.59', '每股收益': '0.14', '总股本': '1.25亿', '昨收': '20.22', '换手率': '6.82%', '最低': '19.83', '跌停': '18.20', '外盘': '3.11万手', '振幅': '4.50%', '量比': '--', '总市值': '25.87亿', '市净率': '3.59', '每股净资产': '5.77', '流通股本': '8222.44万', '股票名称': '科创新源300731'}
{'今开': '15.75', '成交量': '2.54万手', '最高': '16.05', '涨停': '17.29', '内盘': '1.19万手', '成交额': '4056.75万', '委比': '15.79%', '流通市值': '12.06亿', '市盈率<sup>MRQ</sup>': '--', '每股收益': '0.07', '总股本': '1.58亿', '昨收': '15.72', '换手率': '3.36%', '最低': '15.75', '跌停': '14.15', '外盘': '1.46万手', '振幅': '1.91%', '量比': '--', '总市值': '25.20亿', '市净率': '6.39', '每股净资产': '2.50', '流通股本': '7558.08万', '股票名称': '科创信息300730'}
{'今开': '21.46', '成交量': '2140手', '最高': '21.55', '涨停': '23.62', '内盘': '1144手', '成交额': '457.79万', '委比': '3.90%', '流通市值': '5.40亿', '市盈率<sup>MRQ</sup>': '45.48', '每股收益': '0.12', '总股本': '8734.22万', '昨收': '21.47', '换手率': '0.85%', '最低': '21.01', '跌停': '19.32', '外盘': '1084手', '振幅': '2.52%', '量比': '--', '总市值': '18.72亿', '市净率': '2.49', '每股净资产': '8.60', '流通股本': '2518.34万', '股票名称': '乐歌股份300729'}
{'今开': '--', '成交量': '--', '最高': '--', '涨停': '--', '内盘': '--', '成交额': '--', '委比': '--', '流通市值': '--', '市盈率<sup>MRQ</sup>': '--', '每股收益': '--', '总股本': '--', '昨收': '--', '换手率': '--', '最低': '--', '跌停': '--', '外盘': '--', '振幅': '--', '量比': '--', '总市值': '--', '市净率': '--', '每股净资产': '--', '流通股本': '--', '股票名称': '天常股份300728'}
{'今开': '14.77', '成交量': '6113手', '最高': '14.77', '涨停': '16.01', '内盘': '3500手', '成交额': '892.76万', '委比': '39.81%', '流通市值': '5.63亿', '市盈率<sup>MRQ</sup>': '33.45', '每股收益': '0.11', '总股本': '1.27亿', '昨收': '14.55', '换手率': '1.58%', '最低': '14.43', '跌停': '13.10', '外盘': '2877手', '振幅': '2.34%', '量比': '--', '总市值': '18.52亿', '市净率': '3.43', '每股净资产': '4.26', '流通股本': '3859.38万', '股票名称': '润禾材料300727'}
{'今开': '23.00', '成交量': '12.38万手', '最高': '24.27', '涨停': '25.01', '内盘': '5.51万手', '成交额': '2.95亿', '委比': '36.48%', '流通市值': '26.06亿', '市盈率<sup>MRQ</sup>': '43.59', '每股收益': '0.14', '总股本': '4.00亿', '昨收': '22.74', '换手率': '11.42%', '最低': '22.91', '跌停': '20.47', '外盘': '7.67万手', '振幅': '5.98%', '量比': '--', '总市值': '96.14亿', '市净率': '5.98', '每股净资产': '4.02', '流通股本': '1.08亿', '股票名称': '宏达电子300726'}
{'今开': '54.08', '成交量': '2.69万手', '最高': '56.73', '涨停': '59.35', '内盘': '1.06万手', '成交额': '1.50亿', '委比': '2.02%', '流通市值': '51.53亿', '市盈率<sup>MRQ</sup>': '60.48', '每股收益': '0.30', '总股本': '1.43亿', '昨收': '53.95', '换手率': '2.96%', '最低': '53.75', '跌停': '48.56', '外盘': '1.83万手', '振幅': '5.52%', '量比': '--', '总市值': '81.07亿', '市净率': '9.85', '每股净资产': '5.76', '流通股本': '9090.30万', '股票名称': '药石科技300725'}
{'今开': '29.45', '成交量': '3.56万手', '最高': '29.78', '涨停': '32.51', '内盘': '2.04万手', '成交额': '1.04亿', '委比': '0.84%', '流通市值': '22.98亿', '市盈率<sup>MRQ</sup>': '24.67', '每股收益': '0.29', '总股本': '3.20亿', '昨收': '29.55', '换手率': '4.45%', '最低': '28.71', '跌停': '26.60', '外盘': '1.77万手', '振幅': '3.62%', '量比': '--', '总市值': '91.90亿', '市净率': '3.96', '每股净资产': '7.25', '流通股本': '8000.00万', '股票名称': '捷佳伟创300724'}
{'今开': '35.40', '成交量': '3615手', '最高': '35.90', '涨停': '39.07', '内盘': '2200手', '成交额': '1286.60万', '委比': '--', '流通市值': '16.91亿', '市盈率<sup>MRQ</sup>': '29.18', '每股收益': '0.30', '总股本': '1.61亿', '昨收': '35.52', '换手率': '0.76%', '最低': '35.36', '跌停': '31.97', '外盘': '1581手', '振幅': '1.52%', '量比': '--', '总市值': '57.37亿', '市净率': '4.26', '每股净资产': '8.36', '流通股本': '4750.63万', '股票名称': '一品红300723'}
{'今开': '22.00', '成交量': '2.19万手', '最高': '22.95', '涨停': '24.40', '内盘': '9668手', '成交额': '4970.87万', '委比': '8.70%', '流通市值': '6.41亿', '市盈率<sup>MRQ</sup>': '108.95', '每股收益': '0.07', '总股本': '1.12亿', '昨收': '22.18', '换手率': '7.83%', '最低': '22.00', '跌停': '19.96', '外盘': '1.39万手', '振幅': '4.28%', '量比': '--', '总市值': '25.63亿', '市净率': '4.42', '每股净资产': '5.17', '流通股本': '2800.00万', '股票名称': '新余国科300722'}
{'今开': '18.87', '成交量': '1.29万手', '最高': '19.19', '涨停': '20.66', '内盘': '7070手', '成交额': '2441.60万', '委比': '12.35%', '流通市值': '7.92亿', '市盈率<sup>MRQ</sup>': '163.74', '每股收益': '0.03', '总股本': '8058.50万', '昨收': '18.78', '换手率': '3.09%', '最低': '18.81', '跌停': '16.90', '外盘': '6285手', '振幅': '2.02%', '量比': '--', '总市值': '15.31亿', '市净率': '1.76', '每股净资产': '10.81', '流通股本': '4167.26万', '股票名称': '怡达股份300721'}
{'今开': '14.65', '成交量': '6551手', '最高': '14.70', '涨停': '15.91', '内盘': '3389手', '成交额': '955.65万', '委比': '5.77%', '流通市值': '6.08亿', '市盈率<sup>MRQ</sup>': '69.86', '每股收益': '0.08', '总股本': '1.08亿', '昨收': '14.46', '换手率': '1.57%', '最低': '14.46', '跌停': '13.01', '外盘': '3398手', '振幅': '1.66%', '量比': '--', '总市值': '15.71亿', '市净率': '2.27', '每股净资产': '6.42', '流通股本': '4180.68万', '股票名称': '海川智能300720'}
{'今开': '11.52', '成交量': '21.40万手', '最高': '12.18', '涨停': '13.65', '内盘': '12.21万手', '成交额': '2.52亿', '委比': '0.20%', '流通市值': '9.19亿', '市盈率<sup>MRQ</sup>': '--', '每股收益': '0.04', '总股本': '2.54亿', '昨收': '12.41', '换手率': '27.29%', '最低': '11.52', '跌停': '11.17', '外盘': '10.24万手', '振幅': '5.32%', '量比': '--', '总市值': '29.81亿', '市净率': '3.17', '每股净资产': '3.69', '流通股本': '7841.14万', '股票名称': '安达维尔300719'}
{'今开': '16.80', '成交量': '5555手', '最高': '16.95', '涨停': '18.48', '内盘': '2414手', '成交额': '934.07万', '委比': '1.40%', '流通市值': '8.30亿', '市盈率<sup>MRQ</sup>': '28.43', '每股收益': '0.15', '总股本': '1.98亿', '昨收': '16.80', '换手率': '1.12%', '最低': '16.63', '跌停': '15.12', '外盘': '3231手', '振幅': '1.90%', '量比': '--', '总市值': '33.20亿', '市净率': '2.87', '每股净资产': '5.83', '流通股本': '4950.00万', '股票名称': '长盛轴承300718'}
{'今开': '15.58', '成交量': '2.85万手', '最高': '16.19', '涨停': '16.95', '内盘': '1.41万手', '成交额': '4497.63万', '委比': '5.72%', '流通市值': '6.71亿', '市盈率<sup>MRQ</sup>': '29.21', '每股收益': '0.14', '总股本': '1.02亿', '昨收': '15.41', '换手率': '6.71%', '最低': '15.41', '跌停': '13.87', '外盘': '1.51万手', '振幅': '5.06%', '量比': '--', '总市值': '16.16亿', '市净率': '2.92', '每股净资产': '5.40', '流通股本': '4249.60万', '股票名称': '华信新材300717'}
{'今开': '15.36', '成交量': '2.94万手', '最高': '15.36', '涨停': '16.60', '内盘': '1.01万手', '成交额': '4409.92万', '委比': '1.75%', '流通市值': '14.32亿', '市盈率<sup>MRQ</sup>': '70.45', '每股收益': '0.05', '总股本': '1.60亿', '昨收': '15.09', '换手率': '3.10%', '最低': '14.80', '跌停': '13.58', '外盘': '2.02万手', '振幅': '3.71%', '量比': '--', '总市值': '24.18亿', '市净率': '2.89', '每股净资产': '5.23', '流通股本': '9477.00万', '股票名称': '国立科技300716'}
{'今开': '18.31', '成交量': '3757手', '最高': '18.39', '涨停': '20.14', '内盘': '2450手', '成交额': '682.08万', '委比': '10.11%', '流通市值': '7.02亿', '市盈率<sup>MRQ</sup>': '35.11', '每股收益': '0.13', '总股本': '1.32亿', '昨收': '18.31', '换手率': '0.97%', '最低': '17.95', '跌停': '16.48', '外盘': '1388手', '振幅': '2.40%', '量比': '--', '总市值': '23.86亿', '市净率': '5.29', '每股净资产': '3.43', '流通股本': '3870.00万', '股票名称': '凯伦股份300715'}
{'今开': '11.75', '成交量': '1.86万手', '最高': '12.22', '涨停': '12.91', '内盘': '8844手', '成交额': '2239.80万', '委比': '22.11%', '流通市值': '7.76亿', '市盈率<sup>MRQ</sup>': '1055.89', '每股收益': '0.00', '总股本': '1.43亿', '昨收': '11.74', '换手率': '2.90%', '最低': '11.67', '跌停': '10.57', '外盘': '1.10万手', '振幅': '4.68%', '量比': '--', '总市值': '17.33亿', '市净率': '1.61', '每股净资产': '7.51', '流通股本': '6422.38万', '股票名称': '英可瑞300713'}
{'今开': '12.55', '成交量': '4.85万手', '最高': '12.97', '涨停': '13.86', '内盘': '2.28万手', '成交额': '6193.88万', '委比': '40.94%', '流通市值': '10.06亿', '市盈率<sup>MRQ</sup>': '29.47', '每股收益': '0.14', '总股本': '1.82亿', '昨收': '12.60', '换手率': '6.18%', '最低': '12.55', '跌停': '11.34', '外盘': '2.88万手', '振幅': '3.33%', '量比': '--', '总市值': '23.33亿', '市净率': '1.89', '每股净资产': '6.78', '流通股本': '7849.92万', '股票名称': '永福股份300712'}
{'今开': '16.80', '成交量': '6.49万手', '最高': '17.47', '涨停': '18.50', '内盘': '3.36万手', '成交额': '1.11亿', '委比': '3.47%', '流通市值': '9.65亿', '市盈率<sup>MRQ</sup>': '--', '每股收益': '0.02', '总股本': '1.73亿', '昨收': '16.82', '换手率': '11.64%', '最低': '16.63', '跌停': '15.14', '外盘': '3.69万手', '振幅': '4.99%', '量比': '--', '总市值': '29.94亿', '市净率': '4.49', '每股净资产': '3.86', '流通股本': '5576.04万', '股票名称': '广哈通信300711'}
{'今开': '25.72', '成交量': '8919手', '最高': '26.24', '涨停': '28.25', '内盘': '5284手', '成交额': '2306.72万', '委比': '3.85%', '流通市值': '8.62亿', '市盈率<sup>MRQ</sup>': '71.51', '每股收益': '0.09', '总股本': '6861.40万', '昨收': '25.68', '换手率': '2.66%', '最低': '25.66', '跌停': '23.11', '外盘': '4123手', '振幅': '2.26%', '量比': '--', '总市值': '17.65亿', '市净率': '3.03', '每股净资产': '8.50', '流通股本': '3352.40万', '股票名称': '万隆光电300710'}
{'今开': '50.37', '成交量': '2430手', '最高': '50.48', '涨停': '54.73', '内盘': '1173手', '成交额': '1219.33万', '委比': '--', '流通市值': '28.48亿', '市盈率<sup>MRQ</sup>': '--', '每股收益': '0.02', '总股本': '8864.29万', '昨收': '49.75', '换手率': '0.43%', '最低': '49.87', '跌停': '44.77', '外盘': '1322手', '振幅': '1.23%', '量比': '--', '总市值': '44.62亿', '市净率': '3.51', '每股净资产': '14.35', '流通股本': '5658.14万', '股票名称': '精研科技300709'}
{'今开': '14.19', '成交量': '11.37万手', '最高': '14.77', '涨停': '15.57', '内盘': '6.44万手', '成交额': '1.64亿', '委比': '53.95%', '流通市值': '12.64亿', '市盈率<sup>MRQ</sup>': '241.17', '每股收益': '0.03', '总股本': '2.59亿', '昨收': '14.15', '换手率': '12.99%', '最低': '14.19', '跌停': '12.74', '外盘': '5.88万手', '振幅': '4.10%', '量比': '--', '总市值': '37.48亿', '市净率': '5.08', '每股净资产': '2.84', '流通股本': '8748.12万', '股票名称': '聚灿光电300708'}
{'今开': '12.90', '成交量': '1.07万手', '最高': '13.15', '涨停': '13.96', '内盘': '4607手', '成交额': '1391.02万', '委比': '9.94%', '流通市值': '9.98亿', '市盈率<sup>MRQ</sup>': '43.47', '每股收益': '0.07', '总股本': '1.57亿', '昨收': '12.69', '换手率': '1.39%', '最低': '12.75', '跌停': '11.42', '外盘': '6687手', '振幅': '3.15%', '量比': '--', '总市值': '20.33亿', '市净率': '3.19', '每股净资产': '4.05', '流通股本': '7718.90万', '股票名称': '威唐工业300707'}
{'今开': '22.65', '成交量': '3.01万手', '最高': '22.99', '涨停': '24.77', '内盘': '1.50万手', '成交额': '6846.18万', '委比': '15.71%', '流通市值': '12.77亿', '市盈率<sup>MRQ</sup>': '591.34', '每股收益': '0.01', '总股本': '1.41亿', '昨收': '22.52', '换手率': '5.34%', '最低': '22.58', '跌停': '20.27', '外盘': '1.61万手', '振幅': '1.82%', '量比': '--', '总市值': '32.03亿', '市净率': '7.40', '每股净资产': '3.07', '流通股本': '5626.29万', '股票名称': '阿石创300706'}
{'今开': '9.75', '成交量': '1.00万手', '最高': '9.89', '涨停': '10.77', '内盘': '5146手', '成交额': '984.34万', '委比': '0.85%', '流通市值': '9.62亿', '市盈率<sup>MRQ</sup>': '55.25', '每股收益': '0.04', '总股本': '2.35亿', '昨收': '9.79', '换手率': '1.02%', '最低': '9.75', '跌停': '8.81', '外盘': '5347手', '振幅': '1.43%', '量比': '--', '总市值': '23.02亿', '市净率': '3.16', '每股净资产': '3.10', '流通股本': '9810.25万', '股票名称': '九典制药300705'}
{'今开': '9.60', '成交量': '1.43万手', '最高': '9.64', '涨停': '10.47', '内盘': '7772手', '成交额': '1370.08万', '委比': '25.03%', '流通市值': '11.05亿', '市盈率<sup>MRQ</sup>': '48.09', '每股收益': '0.07', '总股本': '1.80亿', '昨收': '9.52', '换手率': '1.23%', '最低': '9.52', '跌停': '8.57', '外盘': '6829手', '振幅': '1.26%', '量比': '--', '总市值': '17.17亿', '市净率': '1.77', '每股净资产': '5.40', '流通股本': '1.16亿', '股票名称': '创源文化300703'}
{'今开': '29.98', '成交量': '2.70万手', '最高': '30.48', '涨停': '32.95', '内盘': '1.49万手', '成交额': '8127.66万', '委比': '6.91%', '流通市值': '15.95亿', '市盈率<sup>MRQ</sup>': '10.69', '每股收益': '0.70', '总股本': '1.82亿', '昨收': '29.95', '换手率': '5.09%', '最低': '29.60', '跌停': '26.95', '外盘': '1.42万手', '振幅': '2.94%', '量比': '--', '总市值': '54.78亿', '市净率': '3.47', '每股净资产': '8.67', '流通股本': '5305.71万', '股票名称': '天宇股份300702'}
{'今开': '22.00', '成交量': '1.42万手', '最高': '22.50', '涨停': '24.18', '内盘': '7629手', '成交额': '3166.65万', '委比': '8.39%', '流通市值': '7.54亿', '市盈率<sup>MRQ</sup>': '39.20', '每股收益': '0.21', '总股本': '1.20亿', '昨收': '21.98', '换手率': '4.18%', '最低': '22.00', '跌停': '19.78', '外盘': '7431手', '振幅': '2.27%', '量比': '--', '总市值': '26.60亿', '市净率': '3.59', '每股净资产': '6.18', '流通股本': '3402.21万', '股票名称': '森霸传感300701'}
{'今开': '27.11', '成交量': '8.18万手', '最高': '27.37', '涨停': '28.69', '内盘': '5.33万手', '成交额': '2.11亿', '委比': '3.76%', '流通市值': '11.29亿', '市盈率<sup>MRQ</sup>': '--', '每股收益': '0.05', '总股本': '8240.00万', '昨收': '26.08', '换手率': '18.46%', '最低': '24.91', '跌停': '23.47', '外盘': '3.47万手', '振幅': '9.43%', '量比': '--', '总市值': '21.00亿', '市净率': '3.95', '每股净资产': '6.44', '流通股本': '4430.75万', '股票名称': '岱勒新材300700'}
{'今开': '35.00', '成交量': '4.64万手', '最高': '35.32', '涨停': '38.19', '内盘': '2.46万手', '成交额': '1.62亿', '委比': '59.23%', '流通市值': '111.23亿', '市盈率<sup>MRQ</sup>': '28.28', '每股收益': '0.43', '总股本': '5.18亿', '昨收': '34.72', '换手率': '1.44%', '最低': '34.40', '跌停': '31.25', '外盘': '2.44万手', '振幅': '2.65%', '量比': '--', '总市值': '179.25亿', '市净率': '4.24', '每股净资产': '8.15', '流通股本': '3.22亿', '股票名称': '光威复材300699'}
{'今开': '16.70', '成交量': '7.57万手', '最高': '18.43', '涨停': '18.43', '内盘': '5.58万手', '成交额': '1.36亿', '委比': '100.00%', '流通市值': '8.38亿', '市盈率<sup>MRQ</sup>': '--', '每股收益': '0.01', '总股本': '1.34亿', '昨收': '16.75', '换手率': '16.66%', '最低': '16.69', '跌停': '15.08', '外盘': '2.99万手', '振幅': '10.39%', '量比': '--', '总市值': '24.70亿', '市净率': '6.51', '每股净资产': '2.83', '流通股本': '4545.14万', '股票名称': '万马科技300698'}
{'今开': '14.69', '成交量': '11.10万手', '最高': '14.93', '涨停': '16.25', '内盘': '6.34万手', '成交额': '1.63亿', '委比': '4.63%', '流通市值': '7.69亿', '市盈率<sup>MRQ</sup>': '23.66', '每股收益': '0.16', '总股本': '2.08亿', '昨收': '14.77', '换手率': '21.35%', '最低': '14.39', '跌停': '13.29', '外盘': '6.00万手', '振幅': '3.66%', '量比': '--', '总市值': '30.74亿', '市净率': '3.87', '每股净资产': '3.82', '流通股本': '5200.00万', '股票名称': '电工合金300697'}
{'今开': '25.45', '成交量': '1.95万手', '最高': '26.75', '涨停': '28.18', '内盘': '8903手', '成交额': '5145.08万', '委比': '10.45%', '流通市值': '13.04亿', '市盈率<sup>MRQ</sup>': '33.07', '每股收益': '0.20', '总股本': '1.19亿', '昨收': '25.62', '换手率': '3.97%', '最低': '25.36', '跌停': '23.06', '外盘': '1.27万手', '振幅': '5.43%', '量比': '--', '总市值': '31.60亿', '市净率': '4.02', '每股净资产': '6.59', '流通股本': '4917.97万', '股票名称': '爱乐达300696'}
{'今开': '49.40', '成交量': '1175手', '最高': '49.44', '涨停': '53.71', '内盘': '521手', '成交额': '577.23万', '委比': '21.43%', '流通市值': '8.22亿', '市盈率<sup>MRQ</sup>': '26.42', '每股收益': '0.47', '总股本': '6667.77万', '昨收': '48.83', '换手率': '0.70%', '最低': '48.79', '跌停': '43.95', '外盘': '661手', '振幅': '1.33%', '量比': '--', '总市值': '32.87亿', '市净率': '1.87', '每股净资产': '26.32', '流通股本': '1667.77万', '股票名称': '兆丰股份300695'}
{'今开': '16.85', '成交量': '2.57万手', '最高': '16.85', '涨停': '18.45', '内盘': '1.65万手', '成交额': '4274.22万', '委比': '13.17%', '流通市值': '8.90亿', '市盈率<sup>MRQ</sup>': '29.94', '每股收益': '0.14', '总股本': '2.15亿', '昨收': '16.77', '换手率': '4.78%', '最低': '16.50', '跌停': '15.09', '外盘': '1.11万手', '振幅': '2.09%', '量比': '--', '总市值': '35.59亿', '市净率': '3.08', '每股净资产': '5.37', '流通股本': '5383.00万', '股票名称': '蠡湖股份300694'}
{'今开': '11.65', '成交量': '9580手', '最高': '11.87', '涨停': '12.66', '内盘': '4735手', '成交额': '1124.34万', '委比': '10.79%', '流通市值': '8.25亿', '市盈率<sup>MRQ</sup>': '174.95', '每股收益': '0.02', '总股本': '1.37亿', '昨收': '11.51', '换手率': '1.36%', '最低': '11.57', '跌停': '10.36', '外盘': '5396手', '振幅': '2.61%', '量比': '--', '总市值': '16.04亿', '市净率': '2.62', '每股净资产': '4.48', '流通股本': '7042.05万', '股票名称': '盛弘股份300693'}
{'今开': '13.14', '成交量': '2.54万手', '最高': '13.35', '涨停': '14.52', '内盘': '1.66万手', '成交额': '3325.73万', '委比': '3.82%', '流通市值': '12.59亿', '市盈率<sup>MRQ</sup>': '33.80', '每股收益': '0.19', '总股本': '1.60亿', '昨收': '13.20', '换手率': '2.62%', '最低': '12.91', '跌停': '11.88', '外盘': '1.05万手', '振幅': '3.33%', '量比': '--', '总市值': '20.77亿', '市净率': '2.67', '每股净资产': '4.86', '流通股本': '9700.50万', '股票名称': '中环环保300692'}
{'今开': '17.68', '成交量': '3.42万手', '最高': '17.84', '涨停': '19.20', '内盘': '1.85万手', '成交额': '6017.14万', '委比': '17.31%', '流通市值': '17.15亿', '市盈率<sup>MRQ</sup>': '80.17', '每股收益': '0.09', '总股本': '2.25亿', '昨收': '17.45', '换手率': '3.52%', '最低': '17.26', '跌停': '15.71', '外盘': '1.75万手', '振幅': '3.32%', '量比': '--', '总市值': '39.74亿', '市净率': '2.80', '每股净资产': '6.29', '流通股本': '9727.80万', '股票名称': '联合光电300691'}
{'今开': '24.30', '成交量': '2.82万手', '最高': '24.78', '涨停': '26.61', '内盘': '1.33万手', '成交额': '6879.36万', '委比': '28.18%', '流通市值': '12.94亿', '市盈率<sup>MRQ</sup>': '19.64', '每股收益': '0.63', '总股本': '1.11亿', '昨收': '24.19', '换手率': '5.40%', '最低': '24.01', '跌停': '21.77', '外盘': '1.67万手', '振幅': '3.18%', '量比': '--', '总市值': '27.49亿', '市净率': '2.94', '每股净资产': '8.42', '流通股本': '5222.69万', '股票名称': '双一科技300690'}

待解决问题

执行过程中,有的网页提取报错了,看了下页面css结构和其他正确的无差,同样的代码,实在不知何故

2019-08-08 22:16:16 [scrapy.core.engine] DEBUG: Crawled (200) <GET https://gupiao.baidu.com/stock/sz300757.html> (referer: http://quote.eastmoney.com/stock_list.html)
2019-08-08 22:16:16 [scrapy.core.scraper] DEBUG: Scraped from <200 https://gupiao.baidu.com/stock/sz300757.html>
{'今开': '27.93', '成交量': '1.32万手', '最高': '29.26', '涨停': '31.02', '内盘': '6720手', '成交额': '3772.23万', '委比': '31.37%', '流通市值': '7.50亿', '市盈率<sup>MRQ</sup>': '119.36', '每股收益': '0.08', '总股本': '1.04亿', '昨收': '28.20', '换手率': '5.08%', '最低': '27.81', '跌停': '25.38', '外盘': '7117手', '振幅': '5.14%', '量比': '--', '总市值': '30.00亿', '市净率': '3.43', '每股净资产': '8.42', '流通股本': '2600.00万', '股票名称': '罗博特科300757'}
2019-08-08 22:16:20 [scrapy.core.engine] DEBUG: Crawled (200) <GET https://gupiao.baidu.com/stock/sz300756.html> (referer: http://quote.eastmoney.com/stock_list.html)
2019-08-08 22:16:21 [scrapy.core.scraper] DEBUG: Scraped from <200 https://gupiao.baidu.com/stock/sz300756.html>
{'今开': '33.60', '成交量': '4605手', '最高': '34.33', '涨停': '36.96', '内盘': '2694手', '成交额': '1561.69万', '委比': '31.00%', '流通市值': '6.09亿', '市盈率<sup>MRQ</sup>': '44.76', '每股收益': '0.34', '总股本': '7200.00万', '昨收': '33.60', '换手率': '2.56%', '最低': '33.56', '跌停': '30.24', '外盘': '2003手', '振幅': '2.29%', '量比': '--', '总市值': '24.38亿', '市净率': '1.37', '每股净资产': '24.73', '流通股本': '1800.00万', '股票名称': '中山金马300756'}
2019-08-08 22:16:25 [scrapy.core.engine] DEBUG: Crawled (200) <GET https://gupiao.baidu.com/stock/sz300755.html> (referer: http://quote.eastmoney.com/stock_list.html)
2019-08-08 22:16:25 [scrapy.core.scraper] DEBUG: Scraped from <200 https://gupiao.baidu.com/stock/sz300755.html>
{'今开': '35.05', '成交量': '2.28万手', '最高': '35.23', '涨停': '38.36', '内盘': '1.44万手', '成交额': '7877.90万', '委比': '7.59%', '流通市值': '20.06亿', '市盈率<sup>MRQ</sup>': '22.63', '每股收益': '0.38', '总股本': '2.32亿', '昨收': '34.87', '换手率': '3.93%', '最低': '34.24', '跌停': '31.38', '外盘': '9764手', '振幅': '2.84%', '量比': '--', '总市值': '80.26亿', '市净率': '3.45', '每股净资产': '10.05', '流通股本': '5788.87万', '股票名称': '华致酒行300755'}
2019-08-08 22:16:28 [scrapy.core.engine] DEBUG: Crawled (200) <GET https://gupiao.baidu.com/stock/sz300753.html> (referer: http://quote.eastmoney.com/stock_list.html)
2019-08-08 22:16:28 [scrapy.core.scraper] DEBUG: Scraped from <200 https://gupiao.baidu.com/stock/sz300753.html>
{'今开': '35.00', '成交量': '1.17万手', '最高': '35.88', '涨停': '38.43', '内盘': '5502手', '成交额': '4147.56万', '委比': '34.08%', '流通市值': '7.20亿', '市盈率<sup>MRQ</sup>': '47.18', '每股收益': '0.19', '总股本': '8080.00万', '昨收': '34.94', '换手率': '5.78%', '最低': '34.89', '跌停': '31.45', '外盘': '7040手', '振幅': '2.83%', '量比': '--', '总市值': '28.78亿', '市净率': '4.64', '每股净资产': '7.67', '流通股本': '2020.00万', '股票名称': '爱朋医疗300753'}
2019-08-08 22:16:31 [scrapy.core.engine] DEBUG: Crawled (200) <GET https://gupiao.baidu.com/stock/sz300752.html> (referer: http://quote.eastmoney.com/stock_list.html)
2019-08-08 22:16:32 [scrapy.core.scraper] ERROR: Spider error processing <GET https://gupiao.baidu.com/stock/sz300752.html> (referer: http://quote.eastmoney.com/stock_list.html)
Traceback (most recent call last):
File "d:\users\bj\appdata\local\programs\python\python36\lib\site-packages\scrapy\utils\defer.py", line 102, in iter_errback
yield next(it)
File "d:\users\bj\appdata\local\programs\python\python36\lib\site-packages\scrapy\spidermiddlewares\offsite.py", line 30, in process_spider_output
for x in result:
File "d:\users\bj\appdata\local\programs\python\python36\lib\site-packages\scrapy\spidermiddlewares\referer.py", line 339, in <genexpr>
return (_set_referer(r) for r in result or ())
File "d:\users\bj\appdata\local\programs\python\python36\lib\site-packages\scrapy\spidermiddlewares\urllength.py", line 37, in <genexpr>
return (r for r in result or () if _filter(r))
File "d:\users\bj\appdata\local\programs\python\python36\lib\site-packages\scrapy\spidermiddlewares\depth.py", line 58, in <genexpr>
return (r for r in result or () if _filter(r))
File "D:\pycodes\BaiduStocks\BaiduStocks\spiders\stocks.py", line 23, in parse_stock
name = stockInfo.css('.bets-name').extract()[0]
IndexError: list index out of range
2019-08-08 22:16:36 [scrapy.core.engine] DEBUG: Crawled (200) <GET https://gupiao.baidu.com/stock/sz300751.html> (referer: http://quote.eastmoney.com/stock_list.html)
2019-08-08 22:16:36 [scrapy.core.scraper] DEBUG: Scraped from <200 https://gupiao.baidu.com/stock/sz300751.html>
{'今开': '143.76', '成交量': '6559手', '最高': '143.76', '涨停': '156.59', '内盘': '4200手', '成交额': '9206.52万', '委比': '76.86%', '流通市值': '18.12亿', '市盈率<sup>MRQ</sup>': '28.52', '每股收益': '1.22', '总股本': '5200.00万', '昨 收': '142.35', '换手率': '5.05%', '最低': '138.11', '跌停': '128.12', '外盘': '2635手', '振幅': '3.97%', '量比': '--', '总市值': '72.49亿', '市净率': '6.20', '每股净资产': '22.47', '流通股本': '1300.00万', '股票名称': '迈为股份300751'}
2019-08-08 22:16:39 [scrapy.core.engine] DEBUG: Crawled (200) <GET https://gupiao.baidu.com/stock/sz300750.html> (referer: http://quote.eastmoney.com/stock_list.html)
2019-08-08 22:16:39 [scrapy.core.scraper] DEBUG: Scraped from <200 https://gupiao.baidu.com/stock/sz300750.html>
{'今开': '74.00', '成交量': '3.84万手', '最高': '74.18', '涨停': '80.66', '内盘': '2.28万手', '成交额': '2.81亿', '委比': '0.47%', '流通市值': '874.69亿', '市盈率<sup>MRQ</sup>': '38.28', '每股收益': '0.48', '总股本': '21.94亿', '昨收': '73.33', '换手率': '0.32%', '最低': '72.80', '跌停': '66.00', '外盘': '1.86万手', '振幅': '1.88%', '量比': '--', '总市值': '1603.48亿', '市净率': '4.69', '每股净资产': '15.59', '流通股本': '11.97亿', '股票名称': '宁德时代300750'}
2019-08-08 22:16:41 [scrapy.core.engine] DEBUG: Crawled (200) <GET https://gupiao.baidu.com/stock/sz300749.html> (referer: http://quote.eastmoney.com/stock_list.html)
2019-08-08 22:16:41 [scrapy.core.scraper] DEBUG: Scraped from <200 https://gupiao.baidu.com/stock/sz300749.html>
{'今开': '12.46', '成交量': '1.90万手', '最高': '12.59', '涨停': '13.72', '内盘': '1.17万手', '成交额': '2370.88万', '委比': '10.98%', '流通市值': '6.32亿', '市盈率<sup>MRQ</sup>': '--', '每股收益': '0.01', '总股本': '2.05亿', '昨收': '12.47', '换手率': '3.71%', '最低': '12.30', '跌停': '11.22', '外盘': '8044手', '振幅': '2.33%', '量比': '--', '总市值': '25.26亿', '市净率': '1.90', '每股净资产': '6.48', '流通股本': '5130.00万', '股票名称': '顶固集创300749'}
05-22 08:18