Python爬虫——scrapy-4

免责声明

本文章仅用于学习交流,无任何商业用途

部分图片来自尚硅谷 

meta简介

        在Scrapy框架中,可以使用meta属性来传递额外的信息。meta属性可以在不同的组件之间传递数据,包括爬虫、中间件和管道等。

        在爬虫中,可以使用meta属性在请求之间传递数据。例如:

yield scrapy.Request(url, callback=self.parse_details, meta={'item': item})

        在上面的例子中,通过设置meta属性,将item对象传递给了下一个请求的回调函数parse_details

在中间件中,可以使用meta属性来获取和修改请求的元数据。例如:

def process_request(self, request, spider):item = request.meta['item']item['timestamp'] = datetime.now()request.meta['item'] = item

        在上面的例子中,process_request方法获取了请求的item对象,并添加了一个timestamp字段,然后将修改后的item对象保存回meta属性中。

在管道中,可以使用meta属性来获取和传递数据。例如:

def process_item(self, item, spider):timestamp = item['timestamp']# 使用timestamp做一些处理

        在上面的例子中,可以从item对象的meta属性中取出之前设置的timestamp值,并进行相应的处理。

        总之,Scrapy的meta属性可以在不同的组件之间传递数据,非常方便灵活。


爬取电影天堂的国内电影的全部名字和图片链接

import scrapy
from scrapy_movie_070.items import ScrapyMovie070Itemclass MvSpider(scrapy.Spider):name = "mv"allowed_domains = ["www.dygod.net"]start_urls = ["https://www.dygod.net/html/gndy/china/index.html"]def parse(self, response):print("==============成功啦===============")# 我们要第一页的名字和第二页的图片a_list = response.xpath('//div[@class="co_content8"]//td[2]//a[2]')for a in a_list:# 获取第一页的name和链接name = a.xpath('./text()').extract_first()src = a.xpath('./@href').extract_first()url = 'https://www.dygod.net' + srcprint(name, url)yield scrapy.Request(url=url, callback=self.parse_second, meta={'name':name})def parse_second(self, response):print("==============呀啦嗦===============")# 如果拿不到数据,记得检查xpath语法是否正确img_src = response.xpath('//div[@id="Zoom"]//img[1]/@src').extract_first()img_url = 'https://www.dygod.net' + img_src# 接收到请求的那个Meta参数的值name = response.meta['name']movie = ScrapyMovie070Item(src=img_url, name=name)yield movie

        CrawlSpider是Scrapy框架中的一个特殊爬虫类,它提供了一种基于规则的快速爬取方式。        CrawlSpider使用了一组规则来定义爬取的行为,并自动根据这些规则对页面上的链接进行跟踪和爬取。

        使用CrawlSpider,可以更轻松地从一个网站中提取数据,而无需编写太多的代码。以下是使用CrawlSpider的基本步骤:

  1. 创建一个CrawlSpider的子类,并设置name属性(爬虫的唯一标识符)和allowed_domains属性(限制爬取的域名)。

  2. 定义一个rules属性,其中包含多个Rule对象,每个Rule对象定义了一个规则。

    • Rule对象的link_extractor属性定义了链接提取器,用于从页面中提取链接。

    • Rule对象的callback属性定义了回调函数,用于处理提取到的链接对应的页面。

  3. 编写回调函数,用于处理提取到的链接对应的页面。

  4. 在回调函数中使用XPath或CSS选择器等方法提取数据,并使用yield语句返回Item对象或新的Request对象,进行进一步的爬取或处理。

以下是一个简单的CrawlSpider示例:

from scrapy.spiders import CrawlSpider, Rule
from scrapy.linkextractors import LinkExtractorclass MySpider(CrawlSpider):name = 'myspider'allowed_domains = ['example.com']start_urls = ['http://www.example.com']rules = (Rule(LinkExtractor(allow=r'/page/\d+'), callback='parse_page', follow=True),)def parse_page(self, response):# 提取数据并返回Item对象yield {'title': response.css('h1::text').get(),'content': response.css('.content::text').getall(),}

        在上面的示例中,allowed_domains属性限制了只爬取example.com域名下的页面。start_urls属性定义了初始爬取的URL。

  rules属性定义了一个规则,其中使用了LinkExtractor来提取符合allow条件的链接,并将提取到的链接交给parse_page方法进行处理。follow=True表示继续跟踪该链接上的页面。

  parse_page方法是回调函数,用于处理提取到的链接对应的页面。在这个方法中,可以使用XPath或CSS选择器等方法提取页面中的数据,并使用yield语句返回Item对象。

        通过以上步骤,就可以创建一个基于规则的爬虫,并使用CrawlSpider类来自动进行页面跟踪和爬取。

        下图来自尚硅谷

C:\Users\14059>scrapy shell https://www.dushu.com/book/1188.html
2024-03-08 17:00:29 [scrapy.utils.log] INFO: Scrapy 2.9.0 started (bot: scrapybot)
2024-03-08 17:00:29 [scrapy.utils.log] INFO: Versions: lxml 5.1.0.0, libxml2 2.10.3, cssselect 1.2.0, parsel 1.8.1, w3lib 2.1.2, Twisted 22.10.0, Python 3.7.5 (tags/v3.7.5:5c02a39a0b, Oct 15 2019, 00:11:34) [MSC v.1916 64 bit (AMD64)], pyOpenSSL 24.0.0 (OpenSSL 3.2.1 30 Jan 2024), cryptography 42.0.5, Platform Windows-10-10.0.22621-SP0
2024-03-08 17:00:29 [scrapy.crawler] INFO: Overridden settings:
{'DUPEFILTER_CLASS': 'scrapy.dupefilters.BaseDupeFilter',
 'LOGSTATS_INTERVAL': 0}
2024-03-08 17:00:29 [py.warnings] WARNING: d:\python\python375\lib\site-packages\scrapy\utils\request.py:232: ScrapyDeprecationWarning: '2.6' is a deprecated value for the 'REQUEST_FINGERPRINTER_IMPLEMENTATION' setting.

It is also the default value. In other words, it is normal to get this warning if you have not defined a value for the 'REQUEST_FINGERPRINTER_IMPLEMENTATION' setting. This is so for backward compatibility reasons, but it will change in a future version of Scrapy.

See the documentation of the 'REQUEST_FINGERPRINTER_IMPLEMENTATION' setting for information on how to handle this deprecation.
  return cls(crawler)

2024-03-08 17:00:29 [scrapy.utils.log] DEBUG: Using reactor: twisted.internet.selectreactor.SelectReactor
2024-03-08 17:00:29 [scrapy.extensions.telnet] INFO: Telnet Password: 13c50912dfa84ac1
2024-03-08 17:00:29 [scrapy.middleware] INFO: Enabled extensions:
['scrapy.extensions.corestats.CoreStats',
 'scrapy.extensions.telnet.TelnetConsole']
2024-03-08 17:00:29 [scrapy.middleware] INFO: Enabled downloader middlewares:
['scrapy.downloadermiddlewares.httpauth.HttpAuthMiddleware',
 'scrapy.downloadermiddlewares.downloadtimeout.DownloadTimeoutMiddleware',
 'scrapy.downloadermiddlewares.defaultheaders.DefaultHeadersMiddleware',
 'scrapy.downloadermiddlewares.useragent.UserAgentMiddleware',
 'scrapy.downloadermiddlewares.retry.RetryMiddleware',
 'scrapy.downloadermiddlewares.redirect.MetaRefreshMiddleware',
 'scrapy.downloadermiddlewares.httpcompression.HttpCompressionMiddleware',
 'scrapy.downloadermiddlewares.redirect.RedirectMiddleware',
 'scrapy.downloadermiddlewares.cookies.CookiesMiddleware',
 'scrapy.downloadermiddlewares.httpproxy.HttpProxyMiddleware',
 'scrapy.downloadermiddlewares.stats.DownloaderStats']
2024-03-08 17:00:29 [scrapy.middleware] INFO: Enabled spider middlewares:
['scrapy.spidermiddlewares.httperror.HttpErrorMiddleware',
 'scrapy.spidermiddlewares.offsite.OffsiteMiddleware',
 'scrapy.spidermiddlewares.referer.RefererMiddleware',
 'scrapy.spidermiddlewares.urllength.UrlLengthMiddleware',
 'scrapy.spidermiddlewares.depth.DepthMiddleware']
2024-03-08 17:00:29 [scrapy.middleware] INFO: Enabled item pipelines:
[]
2024-03-08 17:00:29 [scrapy.extensions.telnet] INFO: Telnet console listening on 127.0.0.1:6023
2024-03-08 17:00:29 [scrapy.core.engine] INFO: Spider opened
2024-03-08 17:00:30 [scrapy.core.engine] DEBUG: Crawled (200) <GET https://www.dushu.com/book/1188.html> (referer: None)
2024-03-08 17:00:30 [asyncio] DEBUG: Using selector: SelectSelector
[s] Available Scrapy objects:
[s]   scrapy     scrapy module (contains scrapy.Request, scrapy.Selector, etc)
[s]   crawler    <scrapy.crawler.Crawler object at 0x00000254496A38C8>
[s]   item       {}
[s]   request    <GET https://www.dushu.com/book/1188.html>
[s]   response   <200 https://www.dushu.com/book/1188.html>
[s]   settings   <scrapy.settings.Settings object at 0x00000254496A3748>
[s]   spider     <DefaultSpider 'default' at 0x25449bbdf88>
[s] Useful shortcuts:
[s]   fetch(url[, redirect=True]) Fetch URL and update local objects (by default, redirects are followed)
[s]   fetch(req)                  Fetch a scrapy.Request and update local objects
[s]   shelp()           Shell help (print this help)
[s]   view(response)    View response in a browser
2024-03-08 17:00:30 [asyncio] DEBUG: Using selector: SelectSelector
2024-03-08 17:00:30 [asyncio] DEBUG: Using selector: SelectSelector
In [1]: from scrapy.linkextractors import LinkExtractor

2024-03-08 17:01:58 [asyncio] DEBUG: Using selector: SelectSelector
In [2]: link = LinkExtractor

2024-03-08 17:02:49 [asyncio] DEBUG: Using selector: SelectSelector
In [3]: from scrapy.linkextractors import LinkExtractor

2024-03-08 17:03:24 [asyncio] DEBUG: Using selector: SelectSelector
In [4]: link = LinkExtractor(allow=r'/book/1188_\d+\.html')

2024-03-08 17:04:45 [asyncio] DEBUG: Using selector: SelectSelector
In [5]: link
Out[6]: <scrapy.linkextractors.lxmlhtml.LxmlLinkExtractor at 0x2544d2ae508>

2024-03-08 17:05:01 [asyncio] DEBUG: Using selector: SelectSelector
In [7]: link.extract_links(response)
Out[7]:
[Link(url='https://www.dushu.com/book/1188_2.html', text='2', fragment='', nofollow=False),
 Link(url='https://www.dushu.com/book/1188_3.html', text='3', fragment='', nofollow=False),
 Link(url='https://www.dushu.com/book/1188_4.html', text='4', fragment='', nofollow=False),
 Link(url='https://www.dushu.com/book/1188_5.html', text='5', fragment='', nofollow=False),
 Link(url='https://www.dushu.com/book/1188_6.html', text='6', fragment='', nofollow=False),
 Link(url='https://www.dushu.com/book/1188_7.html', text='7', fragment='', nofollow=False),
 Link(url='https://www.dushu.com/book/1188_8.html', text='8', fragment='', nofollow=False),
 Link(url='https://www.dushu.com/book/1188_9.html', text='9', fragment='', nofollow=False),
 Link(url='https://www.dushu.com/book/1188_10.html', text='10', fragment='', nofollow=False),
 Link(url='https://www.dushu.com/book/1188_11.html', text='11', fragment='', nofollow=False),
 Link(url='https://www.dushu.com/book/1188_12.html', text='12', fragment='', nofollow=False),
 Link(url='https://www.dushu.com/book/1188_13.html', text='13', fragment='', nofollow=False)]

2024-03-08 17:05:20 [asyncio] DEBUG: Using selector: SelectSelector
In [8]: link1 = LinkExtractor

2024-03-08 17:17:12 [asyncio] DEBUG: Using selector: SelectSelector
In [9]: link1 = LinkExtractor(restrict_xpaths=r'//div[@class="pages"]/a/@href')

2024-03-08 17:18:03 [asyncio] DEBUG: Using selector: SelectSelector
In [10]: link.extract_links(response)
Out[10]:
[Link(url='https://www.dushu.com/book/1188_2.html', text='2', fragment='', nofollow=False),
 Link(url='https://www.dushu.com/book/1188_3.html', text='3', fragment='', nofollow=False),
 Link(url='https://www.dushu.com/book/1188_4.html', text='4', fragment='', nofollow=False),
 Link(url='https://www.dushu.com/book/1188_5.html', text='5', fragment='', nofollow=False),
 Link(url='https://www.dushu.com/book/1188_6.html', text='6', fragment='', nofollow=False),
 Link(url='https://www.dushu.com/book/1188_7.html', text='7', fragment='', nofollow=False),
 Link(url='https://www.dushu.com/book/1188_8.html', text='8', fragment='', nofollow=False),
 Link(url='https://www.dushu.com/book/1188_9.html', text='9', fragment='', nofollow=False),
 Link(url='https://www.dushu.com/book/1188_10.html', text='10', fragment='', nofollow=False),
 Link(url='https://www.dushu.com/book/1188_11.html', text='11', fragment='', nofollow=False),
 Link(url='https://www.dushu.com/book/1188_12.html', text='12', fragment='', nofollow=False),
 Link(url='https://www.dushu.com/book/1188_13.html', text='13', fragment='', nofollow=False)]

整个和命令行斗智斗勇的过程如上了,[○・`Д´・ ○]


CrawlSpider案例

目标:读书网数据入库

(1)创建一个项目

scrapy startproject 项目名

(2)跳转到spdiers 的文件目录下

cd 到spiders为止

cd 项目名\项目名\spiders

(3)创建爬虫文件

scrapy  genspider  -t  crawl  爬虫文件的名字  爬取的域名

注意:一定要注意第一页的URL结构是否和其他页码的结构一样

如果不需要存储到数据库中,代码如下

read.py

import scrapy
from scrapy.linkextractors import LinkExtractor
from scrapy.spiders import CrawlSpider, Rule
from scrapy_readbook_090.items import ScrapyReadbook090Itemclass ReadSpider(CrawlSpider):name = "read"allowed_domains = ["www.dushu.com"]start_urls = ["https://www.dushu.com/book/1188_1.html"]rules = (Rule(LinkExtractor(allow=r"/book/1188_\d+\.html"),callback="parse_item",follow=True),)def parse_item(self, response):img_list = response.xpath('//div[@class="bookslist"]//img')for img in img_list:name = img.xpath('./@alt').extract_first()img_src = img.xpath('./@data-original').extract_first()book = ScrapyReadbook090Item(name=name, src=img_src)yield book

pipelines.py

# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html# useful for handling different item types with a single interface
from itemadapter import ItemAdapterclass ScrapyReadbook090Pipeline:def open_spider(self, spider):self.fp = open('book.json', 'w', encoding='utf-8')def process_item(self, item, spider):self.fp.write(str(item))return itemdef close_spider(self, spider):self.fp.close()

items.py

# Define here the models for your scraped items
#
# See documentation in:
# https://docs.scrapy.org/en/latest/topics/items.htmlimport scrapyclass ScrapyReadbook090Item(scrapy.Item):# define the fields for your item here like:# name = scrapy.Field()name = scrapy.Field()src = scrapy.Field()

settings.py

# Scrapy settings for scrapy_readbook_090 project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
#     https://docs.scrapy.org/en/latest/topics/settings.html
#     https://docs.scrapy.org/en/latest/topics/downloader-middleware.html
#     https://docs.scrapy.org/en/latest/topics/spider-middleware.htmlBOT_NAME = "scrapy_readbook_090"SPIDER_MODULES = ["scrapy_readbook_090.spiders"]
NEWSPIDER_MODULE = "scrapy_readbook_090.spiders"# Crawl responsibly by identifying yourself (and your website) on the user-agent
#USER_AGENT = "scrapy_readbook_090 (+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://docs.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://docs.scrapy.org/en/latest/topics/spider-middleware.html
#SPIDER_MIDDLEWARES = {
#    "scrapy_readbook_090.middlewares.ScrapyReadbook090SpiderMiddleware": 543,
#}# Enable or disable downloader middlewares
# See https://docs.scrapy.org/en/latest/topics/downloader-middleware.html
#DOWNLOADER_MIDDLEWARES = {
#    "scrapy_readbook_090.middlewares.ScrapyReadbook090DownloaderMiddleware": 543,
#}# Enable or disable extensions
# See https://docs.scrapy.org/en/latest/topics/extensions.html
#EXTENSIONS = {
#    "scrapy.extensions.telnet.TelnetConsole": None,
#}# Configure item pipelines
# See https://docs.scrapy.org/en/latest/topics/item-pipeline.html
ITEM_PIPELINES = {"scrapy_readbook_090.pipelines.ScrapyReadbook090Pipeline": 300,
}# Enable and configure the AutoThrottle extension (disabled by default)
# See https://docs.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://docs.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"# Set settings whose default value is deprecated to a future-proof value
REQUEST_FINGERPRINTER_IMPLEMENTATION = "2.7"
TWISTED_REACTOR = "twisted.internet.asyncioreactor.AsyncioSelectorReactor"
FEED_EXPORT_ENCODING = "utf-8"

总结

        其实也没有多大的差距,都适应了其实代码也都挺简单的。主要还是一些细节以及路径的查找上有一点困难。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/730397.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

7-4 哲哲打游戏(Python)

哲哲是一位硬核游戏玩家。最近一款名叫《达诺达诺》的新游戏刚刚上市&#xff0c;哲哲自然要快速攻略游戏&#xff0c;守护硬核游戏玩家的一切&#xff01; 为简化模型&#xff0c;我们不妨假设游戏有 N 个剧情点&#xff0c;通过游戏里不同的操作或选择可以从某个剧情点去往另…

rabbitmq4

独占队列&#xff1a;我们的队列只能被当前通道所绑定&#xff0c;不能被其他的连接所绑定&#xff0c;如果有其他的通道或连接再使用此队列的话&#xff0c;会直接报错&#xff0c;一般设置为false&#xff1a; autoDelete&#xff1a;消费者在消费完队列&#xff0c;并且彻底…

20 卷积层里的填充和步幅【李沐动手学深度学习v2课程笔记】

1. 填充和步幅 在上下左右分别填充一些0 2. 代码实现 2.1 填充 我们创建一个高度和宽度为3的二维卷积层&#xff0c;并在所有侧边填充1个像素。给定高度和宽度为8的输入&#xff0c;则输出的高度和宽度也是8。 import torch from torch import nn# 为了方便起见&#xff0c;…

第三百八十九回

文章目录 1. 概念介绍2. 使用方法2.1 获取所有时区2.2 转换时区时间 3. 示例代码4. 内容总结 我们在上一章回中介绍了"分享一些好的Flutter站点"相关的内容&#xff0c;本章回中将介绍timezone包.闲话休提&#xff0c;让我们一起Talk Flutter吧。 1. 概念介绍 我们在…

LeetCode 2482.行和列中一和零的差值

给你一个下标从 0 开始的 m x n 二进制矩阵 grid 。 我们按照如下过程&#xff0c;定义一个下标从 0 开始的 m x n 差值矩阵 diff &#xff1a; 令第 i 行一的数目为 onesRowi 。 令第 j 列一的数目为 onesColj 。 令第 i 行零的数目为 zerosRowi 。 令第 j 列零的数目为 zer…

el-form-item内的el-select如何自适应宽度

最近在使用element-ui做后台管理的时候&#xff0c;有个需求是在弹窗组件里面&#xff0c;添加一个el-select下拉框选项&#xff0c;但是给el-select设置的宽度无法自适应&#xff0c;原因很简单&#xff0c;我们不需要设置固定宽度&#xff0c;设置百分比就行了&#xff0c;让…

【框架设计】MVC、MVP、MVVM对比图

1. MVC&#xff08;Model-View-Controller&#xff09; 2. MVP&#xff08;Model-View-Presenter&#xff09; 3. MVVM&#xff08;Model-View-ViewModel&#xff09;

Golang基于Redis bitmap实现布隆过滤器(完结版)

Golang基于Redis bitmap实现布隆过滤器&#xff08;完结版&#xff09; 为了防止黑客恶意刷接口&#xff08;请求压根不存在的数据&#xff09;&#xff0c;目前通常有以下几种做法&#xff1a; 限制IP&#xff08;限流&#xff09;Redis缓存不存在的key布隆过滤器挡在Redis前 …

对simplex算法的时间复杂度进行分析

对于simplex算法,如果每进行一次pivot变换,目标函数所得到的结果都会有可能出现增加的情况,所以得到的结论中,可以肯定它的值是一定不会出现减少的情况的,每次从目标函数中找到一个系数大于0的变量,然后再在约束条件中选取能够让它的增值最少的那个来继续进行pivot变换。…

linux kernel物理内存概述(五)

目录 概述 一、快速路径分配 1、get_page_from_freelist 2、rmqueue()函数 二、慢速路径分配 1、分配流程 三、direct_compact 概述 物理内存分配步骤 1、初始化,参数初始化 2、内存充足&#xff0c;快速分配 get_page_from_freelist 3、内存压力大&#xff0c;慢速…

类和对象-C++运算符重载

#include <iostream> #include <string> using namespace std;class Person { public:Person(int age){m_Agenew int (age);}~Person(){if(m_Age!NULL){delete m_Age;m_AgeNULL;}}//重载 赋值运算符Person& operator (Person &p){//编译器提供深拷贝//m_Ag…

嵌入式软件开发工程师如何提高C语言编码技能?

嵌入式软件开发工程师如何提高C语言编码技能&#xff1f; 在开始前我分享下我的经历&#xff0c;我刚入行时遇到一个好公司和师父&#xff0c;给了我机会&#xff0c;一年时间从3k薪资涨到18k的&#xff0c; 我师父给了一些 电气工程师学习方法和资料&#xff0c;让我不断提升…

vSphere 8考试认证题库 2024最新(VCP 8.0版本)

VMware VCP-DCV&#xff08;2V0-21.23&#xff09;认证考试题库&#xff0c;已全部更新&#xff0c;答案已经完成校对&#xff0c;完整题库请扫描上方二维码访问。正常考可以考到450分以上&#xff08;满分500分&#xff0c;300分通过&#xff09; An administrator is tasked …

echarts 模拟时间轴播放效果

使用echarts柱状图模拟时间轴播放控制。开始/暂停/快进/慢进/点选 代码可直接放echart官方示例执行 let start new Date(2024-01-01); let end new Date(2024-01-10); let diff end - start; let dotLen 200;let data [start, end]; option {color: [#3398DB],tooltip: …

论文解读:Rectifying the Shortcut Learning of Background for Few-Shot Learning

文章汇总 问题&动机&解决方法 图像背景是一种有害知识的来源&#xff0c;这是少数镜头学习模型容易吸收的(问题) 通过在训练和评估中提取图像中的前景目标而不需要任何额外的监督来解决这个问题(动机) 在训练和评估时将模型的注意力吸引到图像前景上(方法) 摘要 …

Day25:安全开发-PHP应用文件管理模块包含上传遍历写入删除下载安全

目录 PHP文件操作安全 文件包含 文件删除 文件编辑 文件下载 云产品OSS存储对象去存储文件(泄漏安全) 思维导图 PHP知识点 功能&#xff1a;新闻列表&#xff0c;会员中心&#xff0c;资源下载&#xff0c;留言版&#xff0c;后台模块&#xff0c;模版引用&#xff0c;框…

关于出国留学和考研比较----以本人双非跨考计算机为例

文章目录 中心论点国内就业现状勿让旧认知害了自己那出国留学真的一无是处了吗?1. 藤校仍旧是具有极高价值2. 时间成本低3. 研究生一定比单纯的本科找工作强!4. 很多人说出国读博好,可以无脑入,真是这样吗? 中心论点 如果在选择出国留学还是国内考研的最终核心诉求都是有更好…

向量的内积、长度、正交性

目录 向量的内积 向量的长度&#xff08;模&#xff09; 标准正交基 标准正交化 正交矩阵 向量的内积 向量的长度&#xff08;模&#xff09; 标准正交基 标准正交化 正交矩阵

JavaWeb——014SpringBoot原理(配置优先级、Bean管理、SpringBoot原理)

SpingBoot原理 目录 SpingBoot原理1. 配置优先级2. Bean管理2.1 获取Bean2.2 Bean作用域2.3 第三方Bean 3. SpringBoot原理3.1 起步依赖3.2 自动配置3.2.1 概述3.2.2 常见方案3.2.2.1 概述3.2.2.2 方案一3.2.2.3 方案二 3.2.3 原理分析3.2.3.1 源码跟踪3.2.3.2 Conditional 3.2…

超市小程序有哪些功能 怎么制作

超市小程序是非常有用的工具&#xff0c;可以帮助超市提升用户体验&#xff0c;提高销售额。下面我们来看一下超市小程序可以具备哪些功能&#xff0c;以及如何制作一个高效的超市小程序。 1. **商品展示与搜索功能**&#xff1a;用户可以浏览超市的商品信息&#xff0c;包括价…