14 Off. Reptile company as CEO

On a pass, we learned Scrapy framework, know Scrapy reptile's structure and how it works.

Here Insert Picture Description

Scrapy reptile in the company, the engine is the biggest boss, commanding the scheduler, downloader, reptiles and data pipeline four major sectors.

These four departments are orders from the engine, depending on engine demand is the highest demand.

Here Insert Picture Description

We also project the practical operation of crawled watercress Top250 books, familiar Scrapy usage.

Here Insert Picture Description

This off, I'll take you practical operation of a larger project - with Scrapy crawling recruitment site recruitment information.

icon
you can take this experience a feeling when Scrapy reptile CEO of the company, control code and run the entire operation of Scrapy.

icon
that what we are crawling recruitment website? Among the many job sites, I chose the post Chiyu. This site can be indexed by the way, the search to recruit one hundred new jobs on the site of the country.
Here Insert Picture Description

Now, would you please open the URL link to the post of Friends set the browser (be sure to open oh):

icon
https://www.jobui.com/rank/company/

icon
we first do preliminary observations on this site, so we can clear crawling objectives of the project.

clear goal

After opening the website, you will find: This is the site of the post Chiyu companies list area, which contains a list of business sentiment this month, the best employer reputation, and most fans companies list companies list four most commented list.

Here Insert Picture Description

Click [Beijing] byte beating Technology Co., Ltd., will jump to the company's details page, then click [Job], you can see all the posts information for this company is hiring.

Here Insert Picture Description

After the initial observation, we can crawl target of: first crawled companies list of four companies in the list, followed by crawling the company's recruitment information.

icon
Each list has 10 companies, four is a total of 40 companies list. In other words, we must first take to climb from companies list these 40 companies, 40 companies jump to this page of jobs, crawling to the company name, job title, place of work and recruitment requirements.

Analysis process

Finished clear goal, we start the analysis process. First, look at companies list of companies in the information hidden in where.

Companies list of company information

请你右击打开“检查”工具,点击Network,刷新页面。点开第0个请求company/,看Response,找一下有没有榜单的公司信息在里面。

Here Insert Picture Description

一找,发现四个榜单的所有公司信息都在里面。说明企业排行榜的公司信息就藏在html里。

icon
现在请你点击Elements,点亮光标,再把鼠标移到【北京字节跳动科技有限公司】,这时就会定位到含有这家公司信息的元素上。

Here Insert Picture Description

点击href="/company/10375749/",会跳转到字节跳动这家公司的详情页面。详情页面的网址是:

icon
https://www.jobui.com/company/10375749/
Here Insert Picture Description

你再把鼠标移到【阿里巴巴集团】,点击href="/company/281097/",会跳转到阿里公司的详情页面,页面的网址为:

icon
https://www.jobui.com/company/281097/

icon
我们可以猜到:/company/+数字/应该是公司id的标识。这么一观察,榜单上的公司详情页面的网址规律我们就得出来了。

Here Insert Picture Description

那么,我们只要把元素的href属性的值提取出来,就能构造出每家公司详情页面的网址。

icon
构造公司详情页面的网址是为了后面能获得详情页面里的招聘信息。

icon
现在,我们来分析html的结构,看看怎样才能把元素href属性的值提取出来。

Here Insert Picture Description

仔细观察html的结构,你会发现,每个公司信息都藏在一个

  • 元素里,而每5个
  • 元素都从属与一个
      标签。这是一个层层嵌套的关系。
  • icon
    我们想拿到所有元素href属性的值。我们当然不能直接用find_all()抓取标签,原因也很简单:这个页面有太多的标签,会抓出来很多我们不想要的信息。

    icon
    一个稳妥的方案是:先抓取最外层的

    icon
    这里没有通过抓

  • 元素来获取元素href属性的值,是因为
  • 元素没有class属性,也没有id属性,并不方便我们定位和提取。
  • 分析到这里,我们已经知道公司详情页面的网址规律,和如何提取元素href属性的值。

    icon
    接下来,我们需要分析的就是,每家公司的详情页面。

    公司详情页面的招聘信息

    我们打开【北京字节跳动科技有限公司】的详情页面,点击【招聘】。这时,网址会发生变化,多了jobs的参数。

    Here Insert Picture Description

    如果你多点击几家公司的详情页面,查看招聘信息,就会知道:公司招聘信息的网址规律也是有规律的。

    icon
    比如,阿里的招聘信息的网址是:

    icon
    https://www.jobui.com/company/281097/jobs/

    Here Insert Picture Description

    接着,我们需要找找看公司的招聘信息都存在了哪里。

    icon
    还是在字节跳动公司的招聘信息页面,右击打开“检查”工具,点击Network,刷新页面。我们点击第0个请求jobs/,查看Response,翻找看看里面有没有这家公司的招聘信息。

    Here Insert Picture Description

    在Response里我们找到了想要的招聘信息。这说明公司的招聘信息依旧是藏在了html里。

    icon
    接下来,你应该知道要分析什么了吧。

    icon
    分析的套路都是相同的,知道数据藏在html后,接着是分析html的结构,想办法提取出我们想要的数据。

    icon
    那就按照惯例点击Elements,然后点亮光标,把鼠标移到公司名称吧。

    Here Insert Picture Description

    公司名称藏在

    标签下的 元素的文本中。按道理来说,我们可以通过class属性,定位到
    的这个标签,取出
    标签的文本,就能拿到公司名称。

    icon
    不过经过我几次的操作试验,发现职友集这个网站间隔一段时间就会更换这个标签的名字(可能你此时看到的标签名不一定是

    )。

    icon
    为了保证一定能取到公司名称,我们改成用id属性(id=“companyH1”)来定位这个标签。这样,不管这个标签名字如何更换,我们依旧能抓到它。

    icon
    下面,再把鼠标移到岗位名称,看看招聘的岗位信息可以怎么提取。

    Here Insert Picture Description

    你会发现:每个岗位的信息都藏在一个

  • 标签下,职位名称在元素的文本中,工作地点在元素里,职位要求在元素里。
  • icon
    这样分析下来,我们想要的招聘信息,包括公司名称、职位名称、工作地点和职位要求,都定位清楚了。

    Here Insert Picture Description

    至此,我们分析完了整个爬取过程,接下来就是代码实现啦。

    代码实现

    Here Insert Picture Description

    我们按照Scrapy正常的用法一步步来。首先,我们必须创建一个Scrapy项目。

    创建项目

    icon
    还记得怎么创建吗?打开本地电脑的终端(windows:Win+R,输入cmd;mac:command+空格,搜索“终端”),跳转到你想要保存项目的目录下,输入创建Scrapy项目的命令:scrapy startproject jobui(jobui是职友集网站的英文名,在这里我们把它作为Scrapy项目的名字)。

    icon
    创建好项目后,你在本地电脑的编译器打开这个Scrapy项目,会看到如下的结构:

    Here Insert Picture Description

    提醒:由于课堂教学环境的限制,后面你在课堂的终端里看不到这样的结构。你看到会是一个个的py文件,但实际上它们都是有层级结构的,只是没有显示出来。

    定义item

    icon
    我们刚刚分析的时候,已经确定要爬取的数据是公司名称、职位名称、工作地点和招聘要求。

    icon
    那么,现在请你写出定义item的代码(提示:如果是在本地电脑写的话,是要在items.py这个文件里定义item的)。

    下面,是我写的定义item的代码。

    import scrapy
    
    class JobuiItem(scrapy.Item):
    #定义了一个继承自scrapy.Item的JobuiItem类
        company = scrapy.Field()
        #定义公司名称的数据属性
        position = scrapy.Field()
        #定义职位名称的数据属性
        address = scrapy.Field()
        #定义工作地点的数据属性
        detail = scrapy.Field()
        #定义招聘要求的数据属性
    

    创建和编写爬虫文件

    定义好item,我们接着要做的是在spiders里创建爬虫文件,命名为jobui_ jobs。

    Here Insert Picture Description

    现在,我们可以开始在这个爬虫文件里编写代码。

    icon
    先导入所需的模块:

    import scrapy  
    import bs4
    from ..items import JobuiItem
    

    接下来,是编写爬虫的核心代码。我会先带着你理清代码的逻辑,这样等下你才能比较顺利地理解和写出代码。

    icon
    在前面分析过程的步骤里,我们知道要先抓取企业排行榜40家公司的id标识,比如字节跳动公司的id标识是/company/10375749/。

    Here Insert Picture Description

    再利用抓取到的公司id标识构造出每家公司招聘信息的网址。比如,字节跳动公司的招聘信息网址就是https://www.jobui.com+/company/10375749/jobs/

    icon
    我们需要再把每家公司招聘信息的网址封装成requests对象。这里你可能有点不理解为什么要封装成requests对象,我解释一下。

    icon
    如果我们不是使用Scrapy,而是使用requests库的话,一般我们得到一个网址,需要用requests.get(),传入网址这个参数,才能获取到网页的源代码。

    Here Insert Picture Description

    而在Scrapy里,获取网页源代码这件事儿,会由引擎交分配给下载器去做,不需要我们自己处理。我们之所以要构造新的requests对象,是为了告诉引擎,我们新的请求需要传入什么参数。

    icon
    这样才能让引擎拿到的是正确requests对象,交给下载器处理。

    icon
    既然构造了新的requests对象,我们就得定义与之匹配的用来处理response的新方法。这样才能提取出我们想要的招聘信息的数据。

    icon
    好啦,核心代码的逻辑我们理清楚了。

    Here Insert Picture Description

    我们接着往下写核心代码。

    #导入模块
    import scrapy
    import bs4
    from ..items import JobuiItem
    
    class JobuiSpider(scrapy.Spider):  
    #定义一个爬虫类JobuiSpider
        name = 'jobui'                  
        #定义爬虫的名字为jobui
        allowed_domains = ['www.jobui.com']
        #定义允许爬虫爬取网址的域名——职友集网站的域名
        start_urls = ['https://www.jobui.com/rank/company/']
        #定义起始网址——职友集企业排行榜的网址
    
        def parse(self, response):
        #parse是默认处理response的方法
            bs = bs4.BeautifulSoup(response.text, 'html.parser')
            #用BeautifulSoup解析response(企业排行榜的网页源代码)
            ul_list = bs.find_all('ul',class_="textList flsty cfix")
            #用find_all提取<ul class_="textList flsty cfix">标签
            for ul in ul_list:
            #遍历ul_list
                a_list = ul.find_all('a')
                #用find_all提取出<ul class_="textList flsty cfix">元素里的所有<a>元素
                for a in a_list:
                #再遍历a_list
                    company_id = a['href']
                    #提取出所有<a>元素的href属性的值,也就是公司id标识
                    url = 'https://www.jobui.com{id}jobs'
                    real_url = url.format(id=company_id)
                    #构造出公司招聘信息的网址链接
    

    第6-13行代码:定义了爬虫类JobuiSpider、爬虫的名字jobui、允许爬虫爬取的域名和起始网址。

    icon
    剩下的代码,你应该都能看懂。我们用默认的parse方法来处理response(企业排行榜的网页源代码);用BeautifulSoup来解析response;用find_all方法提取数据(公司id标识)。

    Here Insert Picture Description

    公司id标识就是元素的href属性的值,我们想要把它提取出来,就得先抓到所有最外层的

    icon
    所以这里用了两个for循环,把元素的href属性的值提取了出来,并成功构造了公司招聘信息的网址。

    icon
    代码写到这里,我们已经完成了核心代码逻辑的前两件事:提取企业排行榜的公司id标识和构造公司招聘信息的网址。

    Here Insert Picture Description

    接下来,就是构造新的requests对象和定义新的方法处理response。

    icon
    继续来完善核心代码(请你重点看第21行代码及之后的代码)。

    #导入模块:
    import scrapy
    import bs4
    from ..items import JobuiItem
    
    class JobuiSpider(scrapy.Spider):
        name = 'jobui'
        allowed_domains = ['www.jobui.com']
        start_urls = ['https://www.jobui.com/rank/company/']
        
    #提取公司id标识和构造公司招聘信息的网址:
        def parse(self, response):
        #parse是默认处理response的方法
            bs = bs4.BeautifulSoup(response.text, 'html.parser')
            ul_list = bs.find_all('ul',class_="textList flsty cfix")
            for ul in ul_list:
                a_list = ul.find_all('a')
                for a in a_list:
                    company_id = a['href']
                    url = 'https://www.jobui.com{id}jobs'
                    real_url = url.format(id=company_id)
                    yield scrapy.Request(real_url, callback=self.parse_job)
    #用yield语句把构造好的request对象传递给引擎。用scrapy.Request构造request对象。callback参数设置调用parsejob方法。
    
        def parse_job(self, response):
        #定义新的处理response的方法parse_job(方法的名字可以自己起)
            bs = bs4.BeautifulSoup(response.text, 'html.parser')
            #用BeautifulSoup解析response(公司招聘信息的网页源代码)
            company = bs.find(id="companyH1").text
            #用fin方法提取出公司名称
            datas = bs.find_all('li',class_="company-job-list")
            #用find_all提取<li class_="company-job-list">标签,里面含有招聘信息的数据
            for data in datas:
            #遍历datas
                item = JobuiItem()
                #实例化JobuiItem这个类
                item['company'] = company
                #把公司名称放回JobuiItem类的company属性里
                item['position']=data.find('a').find('h3').text
                #提取出职位名称,并把这个数据放回JobuiItem类的position属性里
                item['address'] = data.find_all('span')[0]['title']
                #提取出工作地点,并把这个数据放回JobuiItem类的address属性里
                item['detail'] = data.find_all('span')[1]['title']
                #提取出招聘要求,并把这个数据放回JobuiItem类的detail属性里
                yield item
                #用yield语句把item传递给引擎
    

    你应该不理解第22行代码:yield scrapy.Request(real_url, callback=self.parse_job)的意思。我跟你解释一下。

    icon
    scrapy.Request是构造requests对象的类。real_url是我们往requests对象里传入的每家公司招聘信息网址的参数。

    icon
    callback的中文意思是回调。self.parse_job是我们新定义的parse_job方法。往requests对象里传入callback=self.parse_job这个参数后,引擎就能知道response要前往的下一站,是parse_job()方法。

    icon
    yield语句就是用来把这个构造好的requests对象传递给引擎。

    icon
    第26行代码,是我们定义的新的parse_job方法。这个方法是用来解析和提取公司招聘信息的数据。

    icon
    对照下面的招聘信息的数据定位表格,你应该能比较好地理解26-43行代码。

    Here Insert Picture Description

    第26-42行代码:提取出公司名称、职位名称、工作地点和招聘要求这些数据,并把这些数据放进我们定义好的JobuiItem类里。

    icon
    最后,用yield语句把item传递给引擎,整个核心代码就编写完啦!ヽ(゚∀゚)メ(゚∀゚)ノ

    存储文件

    icon
    至此,我们整个项目还差存储数据这一步。在第6关,我们学过用csv模块把数据存储csv文件,用openpyxl模块把数据存储Excel文件。

    icon
    其实,在Scrapy里,把数据存储成csv文件和Excel文件,也有分别对应的方法。我们先说csv文件。

    icon
    存储成csv文件的方法比较简单,只需在settings.py文件里,添加如下的代码即可。

    FEED_URI='./storage/data/%(name)s.csv'
    FEED_FORMAT='CSV'
    FEED_EXPORT_ENCODING='ansi'
    

    FEED_URI是导出文件的路径。’./storage/data/%(name)s.csv’,就是把存储的文件放到与settings.py文件同级的storage文件夹的data子文件夹里。

    icon
    FEED_FORMAT 是导出数据格式,写CSV就能得到CSV格式。

    icon
    FEED_EXPORT_ENCODING 是导出文件编码,ansi是一种在windows上的编码格式,你也可以把它变成utf-8用在mac电脑上。

    icon
    存储成Excel文件的方法要稍微复杂一些,我们需要先在setting.py里设置启用ITEM_PIPELINES,设置方法如下:

    #需要修改`ITEM_PIPELINES`的设置代码:
    
    # Configure item pipelines
    # See https://doc.scrapy.org/en/latest/topics/item-pipeline.html
    #ITEM_PIPELINES = {
    #     'jobui.pipelines.JobuiPipeline': 300,
    # }
    

    只要取消ITEM_PIPELINES的注释(删掉#)即可。

    #取消`ITEM_PIPELINES`的注释后:
    
    # Configure item pipelines
    # See https://doc.scrapy.org/en/latest/topics/item-pipeline.html
    ITEM_PIPELINES = {
         'jobui.pipelines.JobuiPipeline': 300,
    }
    

    接着,我们就可以去编辑pipelines.py文件。存储为Excel文件,我们依旧是用openpyxl模块来实现,代码如下,注意阅读注释:

    import openpyxl
    
    class JobuiPipeline(object):
    #定义一个JobuiPipeline类,负责处理item
        def __init__(self):
        #初始化函数 当类实例化时这个方法会自启动
            self.wb =openpyxl.Workbook()
            #创建工作薄
            self.ws = self.wb.active
            #定位活动表
            self.ws.append(['公司', '职位', '地址', '招聘信息'])
            #用append函数往表格添加表头
            
        def process_item(self, item, spider):
        #process_item是默认的处理item的方法,就像parse是默认处理response的方法
            line = [item['company'], item['position'], item['address'], item['detail']]
            #把公司名称、职位名称、工作地点和招聘要求都写成列表的形式,赋值给line
            self.ws.append(line)
            #用append函数把公司名称、职位名称、工作地点和招聘要求的数据都添加进表格
            return item
            #将item丢回给引擎,如果后面还有这个item需要经过的itempipeline,引擎会自己调度
    
        def close_spider(self, spider):
        #close_spider是当爬虫结束运行时,这个方法就会执行
            self.wb.save('./jobui.xlsx')
            #保存文件
            self.wb.close()
            #关闭文件
    

    修改设置

    icon
    在最后,我们还要再修改Scrapy中settings.py文件里的默认设置:添加请求头,以及把ROBOTSTXT_OBEY=True改成ROBOTSTXT_OBEY=False。

    #需要修改的默认设置:
    
    # Crawl responsibly by identifying yourself (and your website) on the user-agent
    #USER_AGENT = 'douban (+http://www.yourdomain.com)'
    
    # Obey robots.txt rules
    ROBOTSTXT_OBEY = True
    

    还有一处默认设置我们需要修改,代码如下:

    # 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 = 0
    

    我们需要取消DOWNLOAD_DELAY = 0这行的注释(删掉#)。DOWNLOAD_DELAY翻译成中文是下载延迟的意思,这行代码可以控制爬虫的速度。因为这个项目的爬取速度不宜过快,我们要把下载延迟的时间改成0.5秒。

    icon
    改好后的代码如下:

    # 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 = 0.5
    

    修改完设置,我们已经可以运行代码。

    Here Insert Picture Description

    代码实操

    icon
    我带你完成了核心代码的编写,现在是时候到你自己动手编写一遍这个项目的核心代码。

    icon
    我在课堂的终端帮你建立好的一个Scrapy项目。等下你会看到你所需要编写或修改的py文件,包括定义item的items.py文件、编写核心代码的jobui_ job.py文件、修改设置的settings.py文件和运行Scrapy的main.py文件,以及存储为Excel会用到的pipelines.py文件。Scrapy项目的其他文件,并不会在课程终端显示出来。

    icon
    提示1:除了编写核心代码,还要定义item、修改设置和运行Scrapy。

    提示2:运行Scrapy的方法,在main.py文件里导入cmdline模块,用execute方法执行终端的命令行:scrapy crawl+项目名

    icon
    提示3:课堂终端的多个文件,只有main.py文件是能点击运行的。

    icon
    提示4:存储为csv还是Excel,你可以自己决定。存储为csv只需要更改setting文件,存储为Excel则还需要修改pipelines.py文件。

    icon
    开始代码实操吧~

    # -*- coding: utf-8 -*-
    
    # Define here the models for your scraped items
    #
    # See documentation in:
    # https://doc.scrapy.org/en/latest/topics/items.html
    
    import scrapy
    
    
    class JobuiTestItem(scrapy.Item):
        # define the fields for your item here like:
        # name = scrapy.Field()
        pass
    
    # -*- 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 JobuiTestPipeline(object):
        def process_item(self, item, spider):
            return item
    
    # -*- coding: utf-8 -*-
    
    # Scrapy settings for jobui_test 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 = 'jobui_test'
    
    SPIDER_MODULES = ['jobui_test.spiders']
    NEWSPIDER_MODULE = 'jobui_test.spiders'
    
    
    # Crawl responsibly by identifying yourself (and your website) on the user-agent
    #USER_AGENT = 'jobui_test (+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 = {
    #    'jobui_test.middlewares.JobuiTestSpiderMiddleware': 543,
    #}
    
    # Enable or disable downloader middlewares
    # See https://doc.scrapy.org/en/latest/topics/downloader-middleware.html
    #DOWNLOADER_MIDDLEWARES = {
    #    'jobui_test.middlewares.JobuiTestDownloaderMiddleware': 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 = {
    #    'jobui_test.pipelines.JobuiTestPipeline': 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'
    

    小结

    icon
    At this point, we use Scarpy completed a complete project. It involves the whole of a reptile: access to data, analytical data, extract data and store data.

    icon
    but it must be pointed out that, subject to limited space, there are many elements not start speaking: Scarpy's own parser how to use? How to request data with parameters? How to write cookies? How do I send a message? How linkage with selenium? How to complete the super-powerful distributed all kinds of reptiles ...... case.

    icon
    If so many, all speaking out may have to add several points. But I think, this is not necessary.

    icon
    way, you've learned resolved with BS data with the data request parameters, adding cookeies, e-mail, coroutine ...... you understand how they work.

    icon
    and secondly, you have to understand the composition and working principle Scrapy framework.

    icon
    Just be a combination of both, combined with exercise, you can easily grasp.

    icon
    today you just do not know how to write syntax Bale. While the grammatical problem, is most likely to solve the problem, we can go read the official document. Because you already have such knowledge, read the document so it will be very simple.

    icon
    at the next level, I prepared a total review of the past knowledge of you, the anti-reptile strategy summary, the guidelines for the future study of reptiles, as well as a letter.

    icon
    we see the next level!

    Published 71 original articles · won praise 19 · views 10000 +

    Guess you like

    Origin blog.csdn.net/Theo93/article/details/104215662