安装

  1. pip install scrapy

建立一个爬虫项目

scrapy startproject 项目名称

  1. scrapy startproject itcast

进入itcast文件夹 生成一个爬虫

scrapy genspider 爬虫名称 "爬虫范围"

  1. scrapy genspider itcast "itcast.cn"

爬虫生成位置

编写itcast.py

  1. # -*- coding: utf-8 -*-
  2. import scrapy
  3.  
  4. class ItcastSpider(scrapy.Spider):
  5. name = "itcast"
  6. allowed_domains = ["itcast.cn"]
  7. start_urls = (
  8. 'http://www.itcast.cn/channel/teacher.shtml',
  9. )
  10.  
  11. def parse(self, response):
  12. # print(response)
  13. data_list = response.xpath("//div[@class='tea_con']//h3/text()").extract() # extract() 返回一个含有字符串数据的列表 如果没用这个方法 返回一个包含选择器的列表
  14. print(data_list) # 乱码 u\u5218.... setting.py中添加了 FEED_EXPORT_ENCODING = 'utf-8' 还是不行 不知道原因 ???
  15. for i in data_list:
  16. print(i) # 此处打印的是中文

乱码是由于ubuntu终端没有中文安装包

安装中文包

  1. apt-get install language-pack-zh

修改 /tec/environment

  1. sudo gedit /etc/environment

在下面添加两行

  1. PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
  2. LANG="zh_CN.UTF-8"
  3. LANGUAGE="zh_CN:zh:en_US:en"

第二行即是默认的中文字符编码。注:可以通过这里修改默认的中文编 码字符,比如修改为:zh_CN.GBK

修改/var/lib/locales/supported.d/local文件

  1. sudo gedit /var/lib/locales/supported.d/local

添加

  1. zh_CN.UTF-8 UTF-8
  2. en_US.UTF-8 UTF-8

保存后,执行命令

  1. sudo locale-gen

重启

  1. sudo reboot

解决 乱码没有了,可以显示中文了

终端打印出来后有其它数据

setting.py中配置log的等级

  1. LOG_LEVEL = "WARNING"

xapath分组 数据传到pipline itcast.py中

  1. # -*- coding: utf-8 -*-
  2. import scrapy
  3.  
  4. class ItcastSpider(scrapy.Spider):
  5. name = "itcast"
  6. allowed_domains = ["itcast.cn"]
  7. start_urls = (
  8. 'http://www.itcast.cn/channel/teacher.shtml',
  9. )
  10.  
  11. def parse(self, response):
  12. # # print(response)
  13. # data_list = response.xpath("//div[@class='tea_con']//h3/text()").extract() # extract() 返回一个含有字符串数据的列表 如果没用这个方法 返回一个包含选择器的列表
  14. # print(data_list) # 乱码 u\u5218.... setting.py中添加了 FEED_EXPORT_ENCODING = 'utf-8' 还是不行 不知道原因 ???
  15. # for i in data_list:
  16. # print(i) # 此处打印的是中文
  17. ret = response.xpath("//div[@class='tea_con']//li") # xpath分组提取
  18. # print(ret)
  19. for i in ret:
  20. item = {}
  21. item['name'] = i.xpath(".//h3/text()").extract_first() # extract_first()相当于 extract()[0] 取列表的第一条数据
  22. # extrack_first() 如果没有数据则返回空列表
  23. # extrack()[0] 如果没有数据会报错
  24. item['position'] = i.xpath(".//h4/text()").extract_first()
  25. item['commondcommond'] = i.xpath(".//p/text()").extract_first()
  26. yield item # 把数据传给pipline

pipline如果想显示接收数据 先要在设置setting.py中开启

  1. # -*- coding:utf-8 -*-
  2.  
  3. # Define your item pipelines here
  4. #
  5. # Don't forget to add your pipeline to the ITEM_PIPELINES setting
  6. # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
  7. import json
  8. import codecs
  9.  
  10. class MyspiderPipeline(object):
  11. # def __init__(self):
  12. # # 定义文件编码及名称
  13. # self.file = codecs.open('中文乱码.json', 'wb', encoding='utf-8')
  14.  
  15. def process_item(self, item, spider): # 实现存储方法
  16. # line = json.dumps(dict(item)) + '\n'
  17. # print(line.decode("unicode_escape"))
  18. # 写入一行,每行为一个抓取项
  19. # self.file.write(line.decode("unicode_escape"))
  20. # return item
  21. print(item)
         return item

查看效果,控制端输入代码

  1. scrapy crawl itcast

使用多个pipline

  1. # -*- coding:utf-8 -*-
  2.  
  3. # Define your item pipelines here
  4. #
  5. # Don't forget to add your pipeline to the ITEM_PIPELINES setting
  6. # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
  7. import json
  8. import codecs
  9.  
  10. class MyspiderPipeline(object):
  11. # def __init__(self):
  12. # # 定义文件编码及名称
  13. # self.file = codecs.open('中文乱码.json', 'wb', encoding='utf-8')
  14.  
  15. def process_item(self, item, spider):
  16. # line = json.dumps(dict(item)) + '\n'
  17. # print(line.decode("unicode_escape"))
  18. # 写入一行,每行为一个抓取项
  19. # self.file.write(line.decode("unicode_escape"))
  20. # return item
  21. del item["commondcommond"] # 删除详细介绍
  22. return item
  23.  
  24. class MyspiderPipeline2(object):
  25. def process_item(self, item, spider):
  26. print(item) # 此时item是从上面方法处理后的item
  27. return item

配置setting.py

  1. # Configure item pipelines
  2. # See http://scrapy.readthedocs.org/en/latest/topics/item-pipeline.html
  3. ITEM_PIPELINES = {
  4. 'myspider.pipelines.MyspiderPipeline': 300,
  5. 'myspider.pipelines.MyspiderPipeline2': 301,
  6. }

查看效果

创建多个爬虫

一个爬虫项目是包含多个爬虫的

  1. scrapy genspider itcast2 itcast.cn
  2. scrapy genspider itcast3 itcast.cn

关于多个爬虫的pipline处理方式:

爬虫itcast.py返回值里添加comfrom

  1. def parse(self, response):
  2. # # print(response)
  3. # data_list = response.xpath("//div[@class='tea_con']//h3/text()").extract() # extract() 返回一个含有字符串数据的列表 如果没用这个方法 返回一个包含选择器的列表
  4. # print(data_list) # 乱码 u\u5218.... setting.py中添加了 FEED_EXPORT_ENCODING = 'utf-8' 还是不行 不知道原因 ???
  5. # for i in data_list:
  6. # print(i) # 此处打印的是中文
  7. ret = response.xpath("//div[@class='tea_con']//li") # xpath分组提取
  8. # print(ret)
  9. for i in ret:
  10. item = {}
  11. item['comfrom'] = 'itcast' # 便于pipline区分
  12. item['name'] = i.xpath(".//h3/text()").extract_first() # extract_first()相当于 extract()[0] 取列表的第一条数据
  13. # extrack_first() 如果没有数据则返回空列表
  14. # extrack()[0] 如果没有数据会报错
  15. item['position'] = i.xpath(".//h4/text()").extract_first()
  16. item['commond'] = i.xpath(".//p/text()").extract_first()
  17. yield item # 把数据传给pipline

1.多个爬虫使用一个pipline

piplind处理方法

  1. class MyspiderPipeline(object):
  2. def process_item(self, item, spider):
  3.  
  4. if item['comfrom'] == 'itcast':
  5. pass # itcast的处理方式
  6. elif item['comfrom'] == 'itcast2':
  7. pass # itcast2 的处理方式
  8. else:
  9. pass # itcast3 的处理方式

2.多个爬虫使用多个pipline区分

  1. class MyspiderPipeline(object):
  2. def process_item(self, item, spider):
  3.  
  4. if item['comfrom'] == 'itcast':
  5. pass # itcast的处理方式
  6.  
  7. class MyspiderPipeline2(object):
  8. def process_item(self, item, spider):
  9.  
  10. if item['comfrom'] == 'itcast2':
  11. pass # itcast2 的处理方式
  12.  
  13. class MyspiderPipeline3(object):
  14. def process_item(self, item, spider):
  15. if item['comfrom'] == 'itcast3':
  16. pass # itcast3 的处理方式

配置seting.py里注册pipline2、pipline3的权重

  1. ITEM_PIPELINES = {
  2. 'myspider.pipelines.MyspiderPipeline': 300,
  3. 'myspider.pipelines.MyspiderPipeline2': 301,
  4. 'myspider.pipelines.MyspiderPipeline3': 302,
  5. }

3.根据spider.name区分

  1. # -*- coding: utf-8 -*-
  2. import scrapy
  3.  
  4. class ItcastSpider(scrapy.Spider):
  5. name = "itcast" # 类属性name 便于piplinde区分
  6. allowed_domains = ["itcast.cn"]
  7. start_urls = (
  8. 'http://www.itcast.cn/channel/teacher.shtml',
  9. )
  10.  
  11. def parse(self, response):
  12. # # print(response)
  13. # data_list = response.xpath("//div[@class='tea_con']//h3/text()").extract() # extract() 返回一个含有字符串数据的列表 如果没用这个方法 返回一个包含选择器的列表
  14. # print(data_list) # 乱码 u\u5218.... setting.py中添加了 FEED_EXPORT_ENCODING = 'utf-8' 还是不行 不知道原因 ???
  15. # for i in data_list:
  16. # print(i) # 此处打印的是中文
  17. ret = response.xpath("//div[@class='tea_con']//li") # xpath分组提取
  18. # print(ret)
  19. for i in ret:
  20. item = {}
  21. item['comfrom'] = 'itcast'
  22. item['name'] = i.xpath(".//h3/text()").extract_first() # extract_first()相当于 extract()[0] 取列表的第一条数据
  23. # extrack_first() 如果没有数据则返回空列表
  24. # extrack()[0] 如果没有数据会报错
  25. item['position'] = i.xpath(".//h4/text()").extract_first()
  26. item['commond'] = i.xpath(".//p/text()").extract_first()
  27. yield item # 把数据传给pipline

pipline中

  1. class MyspiderPipeline(object):
  2. def process_item(self, item, spider):
  3.  
  4. if spider.name == 'itcast':
  5. pass # 当spider的类属性name是itcast时的处理方式

使用loggin日志

开启日志输出到文件配置sitting.py

  1. LOG_LEVEL = "WARNING" # 日志级别
  2. LOG_FILE = "./log.log" # 把日志保存到文件, 文件保存位置

itcast.py或者pipline中

  1. # -*- coding: utf-8 -*-
  2. import scrapy
  3. import logging
  4.  
  5. logger = logging.getLogger(__name__) # 获取logger对象 可以以spider名称存入log日志
  6.  
  7. class ItcastSpider(scrapy.Spider):
  8. name = "itcast"
  9. allowed_domains = ["itcast.cn"]
  10. start_urls = (
  11. 'http://www.itcast.cn/channel/teacher.shtml',
  12. )
  13.  
  14. def parse(self, response):
  15. # # print(response)
  16. # data_list = response.xpath("//div[@class='tea_con']//h3/text()").extract() # extract() 返回一个含有字符串数据的列表 如果没用这个方法 返回一个包含选择器的列表
  17. # print(data_list) # 乱码 u\u5218.... setting.py中添加了 FEED_EXPORT_ENCODING = 'utf-8' 还是不行 不知道原因 ???
  18. # for i in data_list:
  19. # print(i) # 此处打印的是中文
  20. ret = response.xpath("//div[@class='tea_con']//li") # xpath分组提取
  21. # print(ret)
  22. for i in ret:
  23. item = {}
  24. item['comfrom'] = 'itcast'
  25. item['name'] = i.xpath(".//h3/text()").extract_first() # extract_first()相当于 extract()[0] 取列表的第一条数据
  26. # extrack_first() 如果没有数据则返回空列表
  27. # extrack()[0] 如果没有数据会报错
  28. item['position'] = i.xpath(".//h4/text()").extract_first()
  29. item['commond'] = i.xpath(".//p/text()").extract_first()
  30. logger.warning(item) # 对应setting配置的LOG_LEVEL级别,把日志输出到日志文件
  31. yield item # 把数据传给pipline

实现翻页请求

实例

  1. # 获取总页数
  2. pageNum=math.ceil(data_lists['Data']['Count']/10)
  3. # 设置第二页页码
  4. pageIndex = 2
  5. while pageIndex<=pageNum:
  6. next_url = "https://careers.tencent.com/tencentcareer/api/post/Query?pageIndex={}&pageSize=10".format(pageIndex)
  7. yield scrapy.Request(
  8. next_url,
  9. callback=self.parse
  10. )
  11. pageIndex += 1

meta用途

  1. def parse(self, response):
  2. data_lists = json.loads(response.text)
  3. data_list = data_lists['Data']['Posts']
  4. for data in data_list:
  5. item = {}
  6. item['RecruitPostName'] = data['RecruitPostName']
  7. item['CountryName'] = data['CountryName']
  8. item['PostURL'] = data['PostURL']
  9. item['LastUpdateTime'] = data['LastUpdateTime']
  10. print(item)
  11.  
  12. # 获取总页数
  13. pageNum=math.ceil(data_lists['Data']['Count']/10)
  14. # 设置第二页页码
  15. pageIndex = 2
  16. while pageIndex<=pageNum:
  17. next_url = "https://careers.tencent.com/tencentcareer/api/post/Query?pageIndex={}&pageSize=10".format(pageIndex)
  18. yield scrapy.Request(
  19. next_url,
  20. callback=self.parse,
  21. meta={"item":item} # meta用法 在不同的解析函数中传递数据
  22. )
  23. pageIndex += 1
  24.  
  25. def parse1(self, response):
  26. item = response.meta["item"]

Scrapy深入之定义Item

可以在items.py中把要爬取的字段定义好

  1. # -*- coding: utf-8 -*-
  2.  
  3. # Define here the models for your scraped items
  4. #
  5. # See documentation in:
  6. # http://doc.scrapy.org/en/latest/topics/items.html
  7.  
  8. import scrapy
  9.  
  10. class HrItem(scrapy.Item):
  11. # define the fields for your item here like:
  12. # name = scrapy.Field()
  13. RecruitPostName = scrapy.Field()
  14. CountryName = scrapy.Field()
  15. PostURL = scrapy.Field()
  16. LastUpdateTime = scrapy.Field()

此时要把爬虫tencent.py中关于item字典改动一下

  1. # -*- coding: utf-8 -*-
  2. import scrapy
  3. import json
  4. import math
  5. from hr.items import HrItem
  6.  
  7. class TencentSpider(scrapy.Spider):
  8. name = "tencent"
  9. allowed_domains = ["tencent.com"]
  10. start_urls = (
  11. 'https://careers.tencent.com/tencentcareer/api/post/Query?pageIndex=1&pageSize=10',
  12. )
  13.  
  14. def parse(self, response):
  15. data_lists = json.loads(response.text)
  16. data_list = data_lists['Data']['Posts']
  17. for data in data_list:
  18. item = HrItem()
  19. item['RecruitPostName1'] = data['RecruitPostName'] # 与items.py中定义的字段不一致 会报错
  20. item['CountryName'] = data['CountryName']
  21. item['PostURL'] = data['PostURL']
  22. item['LastUpdateTime'] = data['LastUpdateTime']
  23. yield item # 数据传给piplines# 获取总页数
  24. pageNum=math.ceil(data_lists['Data']['Count']/10)
  25. # 设置第二页页码
  26. pageIndex = 2
  27. while pageIndex<=pageNum:
  28. next_url = "https://careers.tencent.com/tencentcareer/api/post/Query?pageIndex={}&pageSize=10".format(pageIndex)
  29. yield scrapy.Request(
  30. next_url,
  31. callback=self.parse,
  32. meta={"item":item} # meta用法 在不同的解析函数中传递数据
  33. )
  34. pageIndex += 1
  35.  
  36. def parse2(self, response):
  37. item = response.meta["item"]

pipelines.py中处理数据

  1. # -*- coding: utf-8 -*-
  2.  
  3. # Define your item pipelines here
  4. #
  5. # Don't forget to add your pipeline to the ITEM_PIPELINES setting
  6. # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
  7. from pymongo import MongoClient
  8. from hr.items import HrItem
  9.  
  10. client = MongoClient()
  11. collection = client["hr"]["tencent"]
  12.  
  13. class HrPipeline(object):
  14. def process_item(self, item, spider):
  15. if isinstance(item, HrItem): # 判断item是否属于Hritem
  16. print(item)
  17. collection.insert(dict(item)) # 导入到mongoDb前要先转化成字典
  18.  
  19. return item

scrapy配置信息settings.py

  1. # -*- coding: utf-8 -*-
  2.  
  3. # Scrapy settings for yangguang project
  4. #
  5. # For simplicity, this file contains only settings considered important or
  6. # commonly used. You can find more settings consulting the documentation:
  7. #
  8. # https://docs.scrapy.org/en/latest/topics/settings.html
  9. # https://docs.scrapy.org/en/latest/topics/downloader-middleware.html
  10. # https://docs.scrapy.org/en/latest/topics/spider-middleware.html
  11.  
  12. BOT_NAME = 'yangguang' # 项目名
  13.  
  14. SPIDER_MODULES = ['yangguang.spiders'] # 爬虫所在的位置
  15. NEWSPIDER_MODULE = 'yangguang.spiders' # 新建爬虫所在位置
  16.  
  17. # Crawl responsibly by identifying yourself (and your website) on the user-agent
  18. USER_AGENT = 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.80 Safari/537.36'
  19.  
  20. # Obey robots.txt rules
  21. ROBOTSTXT_OBEY = True # True遵守robots协议 False不遵守协议
  22.  
  23. LOG_LEVEL = "WARNING" # LOG日志等级
  24.  
  25. FEED_EXPORT_ENCODING = 'UTF-8'
  26.  
  27. # Configure maximum concurrent requests performed by Scrapy (default: 16)
  28. #CONCURRENT_REQUESTS = 32 # 并发 同时最大数目为32
  29.  
  30. # Configure a delay for requests for the same website (default: 0)
  31. # See https://docs.scrapy.org/en/latest/topics/settings.html#download-delay
  32. # See also autothrottle settings and docs
  33. #DOWNLOAD_DELAY = 3 # 下载延迟 每次下载前睡3秒 让爬虫更慢性
  34. # The download delay setting will honor only one of:
  35. #CONCURRENT_REQUESTS_PER_DOMAIN = 16 # 每个域名的最大并发请求数
  36. #CONCURRENT_REQUESTS_PER_IP = 16 # 没个IP的最大并发请求数
  37.  
  38. # Disable cookies (enabled by default)
  39. #COOKIES_ENABLED = False # 是否开启COOKIE 默认是开启的
  40.  
  41. # Disable Telnet Console (enabled by default)
  42. #TELNETCONSOLE_ENABLED = False # 是否配置插件 默认是开启的
  43.  
  44. # Override the default request headers: # 默认请求头
  45. #DEFAULT_REQUEST_HEADERS = {
  46. # 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
  47. # 'Accept-Language': 'en',
  48. #}
  49.  
  50. # Enable or disable spider middlewares
  51. # See https://docs.scrapy.org/en/latest/topics/spider-middleware.html
  52. #SPIDER_MIDDLEWARES = { # 爬虫中间件
  53. # 'yangguang.middlewares.YangguangSpiderMiddleware': 543,
  54. #}
  55.  
  56. # Enable or disable downloader middlewares
  57. # See https://docs.scrapy.org/en/latest/topics/downloader-middleware.html
  58. #DOWNLOADER_MIDDLEWARES = { # 下载中间件
  59. # 'yangguang.middlewares.YangguangDownloaderMiddleware': 543,
  60. #}
  61.  
  62. # Enable or disable extensions
  63. # See https://docs.scrapy.org/en/latest/topics/extensions.html
  64. #EXTENSIONS = { # 插件
  65. # 'scrapy.extensions.telnet.TelnetConsole': None,
  66. #}
  67.  
  68. # Configure item pipelines
  69. # See https://docs.scrapy.org/en/latest/topics/item-pipeline.html
  70. ITEM_PIPELINES = { # pipelines 位置和权重
  71. 'yangguang.pipelines.YangguangPipeline': 300,
  72. }
  73.  
  74. # Enable and configure the AutoThrottle extension (disabled by default) # AutoThrottle自动限速
  75. # See https://docs.scrapy.org/en/latest/topics/autothrottle.html
  76. #AUTOTHROTTLE_ENABLED = True
  77. # The initial download delay
  78. #AUTOTHROTTLE_START_DELAY = 5
  79. # The maximum download delay to be set in case of high latencies
  80. #AUTOTHROTTLE_MAX_DELAY = 60
  81. # The average number of requests Scrapy should be sending in parallel to
  82. # each remote server
  83. #AUTOTHROTTLE_TARGET_CONCURRENCY = 1.0
  84. # Enable showing throttling stats for every response received:
  85. #AUTOTHROTTLE_DEBUG = False
  86.  
  87. # Enable and configure HTTP caching (disabled by default) # 缓存
  88. # See https://docs.scrapy.org/en/latest/topics/downloader-middleware.html#httpcache-middleware-settings
  89. #HTTPCACHE_ENABLED = True
  90. #HTTPCACHE_EXPIRATION_SECS = 0
  91. #HTTPCACHE_DIR = 'httpcache'
  92. #HTTPCACHE_IGNORE_HTTP_CODES = []
  93. #HTTPCACHE_STORAGE = 'scrapy.extensions.httpcache.FilesystemCacheStorage'

scrapy框架--?乱码unicode的更多相关文章

  1. 爬了个爬(三)Scrapy框架

    参考博客:武Sir Scrapy是一个为了爬取网站数据,提取结构性数据而编写的应用框架. 其可以应用在数据挖掘,信息处理或存储历史数据等一系列的程序中.其最初是为了页面抓取 (更确切来说, 网络抓取 ...

  2. python爬虫入门(六) Scrapy框架之原理介绍

    Scrapy框架 Scrapy简介 Scrapy是用纯Python实现一个为了爬取网站数据.提取结构性数据而编写的应用框架,用途非常广泛. 框架的力量,用户只需要定制开发几个模块就可以轻松的实现一个爬 ...

  3. 爬虫入门(四)——Scrapy框架入门:使用Scrapy框架爬取全书网小说数据

    为了入门scrapy框架,昨天写了一个爬取静态小说网站的小程序 下面我们尝试爬取全书网中网游动漫类小说的书籍信息. 一.准备阶段 明确一下爬虫页面分析的思路: 对于书籍列表页:我们需要知道打开单本书籍 ...

  4. 解读Scrapy框架

    Scrapy框架基础:Twsited Scrapy内部基于事件循环的机制实现爬虫的并发.原来: url_list = ['http://www.baidu.com','http://www.baidu ...

  5. scrapy框架使用教程

    scrapy框架真的是很强大.非常值得学习一下.本身py就追求简洁,所以本身代码量很少却能写出很强大的功能.对比java来说.不过py的语法有些操蛋,比如没有智能提示.动态语言的通病.我也刚学习不到1 ...

  6. python 全栈开发,Day138(scrapy框架的下载中间件,settings配置)

    昨日内容拾遗 打开昨天写的DianShang项目,查看items.py class AmazonItem(scrapy.Item): name = scrapy.Field() # 商品名 price ...

  7. python 全栈开发,Day137(爬虫系列之第4章-scrapy框架)

    一.scrapy框架简介 1. 介绍 Scrapy一个开源和协作的框架,其最初是为了页面抓取 (更确切来说, 网络抓取 )所设计的,使用它可以以快速.简单.可扩展的方式从网站中提取所需的数据.但目前S ...

  8. Scrapy框架——CrawlSpider类爬虫案例

    Scrapy--CrawlSpider Scrapy框架中分两类爬虫,Spider类和CrawlSpider类. 此案例采用的是CrawlSpider类实现爬虫. 它是Spider的派生类,Spide ...

  9. Scrapy框架爬虫

    一.sprapy爬虫框架 pip install pypiwin32 1) 创建爬虫框架 scrapy startproject Project # 创建爬虫项目 You can start your ...

  10. python高级之scrapy框架

    目录: 爬虫性能原理 scrapy框架解析 一.爬虫性能原理 在编写爬虫时,性能的消耗主要在IO请求中,当单进程单线程模式下请求URL时必然会引起等待,从而使得请求整体变慢. 1.同步执行 impor ...

随机推荐

  1. Elasticsearch由浅入深(八)搜索引擎:mapping、精确匹配与全文搜索、分词器、mapping总结

    下面先简单描述一下mapping是什么? 自动或手动为index中的type建立的一种数据结构和相关配置,简称为mappingdynamic mapping,自动为我们建立index,创建type,以 ...

  2. 推荐一款移动端小视频App玲珑视频

    推荐一款移动端小视频App玲珑视频 一 应用描述 玲珑小视频,边看边聊![海量视频,刷个不停,还能找妹子语音聊天哦][随手拍一拍,记录美好生活,还能拿金币哦][看视频领金币.登录领金币.拍视频领金币. ...

  3. swagger Unable to render this definition

    Unable to render this definition The provided definition does not specify a valid version field. Ple ...

  4. Kubernetes 学习(十)Kubernetes 容器持久化存储

    0. 前言 最近在学习张磊老师的 深入剖析Kubernetes 系列课程,最近学到了 Kubernetes 容器持久化存储部分 现对这一部分的相关学习和体会做一下整理,内容参考 深入剖析Kuberne ...

  5. 解决Spring Cloud中Feign第一次请求失败的问题

    在Spring Cloud中,Feign和Ribbon在整合了Hystrix后,可能会出现首次调用失败的问题 com.netflix.hystrix.exception.HystrixTimeoutE ...

  6. flutter RN taro选型思考

    当前RN已经成熟,但是依赖于大平台(JD.携程),小公司想开箱即用还是有困难的 纯Flutter还远未成熟,更多的是和原生进行混合 但是作为个体又想要在某一个点切入市场,就是需要作选择,基于当下及未来 ...

  7. spring bean的三种管理方式·

    1.无参构造函数 1.xml文件配置内容 <!--无参构造函数--> <bean id="bean1" class="com.imooc.ioc.dem ...

  8. Linux内核中的并发与竞态概述

    1.前言 众所周知,Linux系统是一个多任务的操作系统,当多个任务同时访问同一片内存区域的时候,这些任务可能会相互覆盖内存中数据,从而造成内存中的数据混乱,问题严重的话,还可能会导致系统崩溃. 2. ...

  9. 转 Java jar (SpringBoot Jar)转为win可执行的exe程序

    原文链接:http://voidm.com/2018/12/29/java-jar-transform-exe/打包Jar工程 将java项目打包成jar工程,可以是文章以SpringBoot为例po ...

  10. [转] Performance_js中计算网站性能监控利器

    1.Performance方法 Performance提供的方法可以灵活使用,获取到页面加载等标记的耗时情况. performance.now() //返回当前到页面打开时刻的耗时,精确到千分之一毫秒 ...