diff --git "a/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/10.\345\212\250\346\200\201\346\270\262\346\237\223\351\241\265\351\235\242\347\210\254\345\217\226/config.json" "b/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/10.\345\212\250\346\200\201\346\270\262\346\237\223\351\241\265\351\235\242\347\210\254\345\217\226/config.json" index 6c942eeb66dd6cee4f795d5a38731c1142f71a56..70d1b53207ace32562e8ccb735754ad5df9bdb96 100644 --- "a/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/10.\345\212\250\346\200\201\346\270\262\346\237\223\351\241\265\351\235\242\347\210\254\345\217\226/config.json" +++ "b/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/10.\345\212\250\346\200\201\346\270\262\346\237\223\351\241\265\351\235\242\347\210\254\345\217\226/config.json" @@ -1,5 +1,5 @@ { - "export": [], + "export": ["dynamic_page.json"], "keywords": [], "children": [ { diff --git "a/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/10.\345\212\250\346\200\201\346\270\262\346\237\223\351\241\265\351\235\242\347\210\254\345\217\226/dynamic_page.json" "b/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/10.\345\212\250\346\200\201\346\270\262\346\237\223\351\241\265\351\235\242\347\210\254\345\217\226/dynamic_page.json" new file mode 100644 index 0000000000000000000000000000000000000000..9426ef9cd9cad2d53cc3574824d471e6fe85ac0a --- /dev/null +++ "b/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/10.\345\212\250\346\200\201\346\270\262\346\237\223\351\241\265\351\235\242\347\210\254\345\217\226/dynamic_page.json" @@ -0,0 +1,6 @@ +{ + "author": "zxm2015", + "source": "dynamic_page.md", + "depends": [], + "type": "code_options" +} \ No newline at end of file diff --git "a/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/10.\345\212\250\346\200\201\346\270\262\346\237\223\351\241\265\351\235\242\347\210\254\345\217\226/dynamic_page.md" "b/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/10.\345\212\250\346\200\201\346\270\262\346\237\223\351\241\265\351\235\242\347\210\254\345\217\226/dynamic_page.md" new file mode 100644 index 0000000000000000000000000000000000000000..a2c871ca0588c7d37e9e88d0aaf267c6de3a3435 --- /dev/null +++ "b/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/10.\345\212\250\346\200\201\346\270\262\346\237\223\351\241\265\351\235\242\347\210\254\345\217\226/dynamic_page.md" @@ -0,0 +1,56 @@ +# 爬取动态页面 + +现在想爬取一个url为下拉滚动的页面,下列选项可以爬取到下列页面内容的是: + + + +## 答案 + +```python +import time +from selenium import webdriver +from bs4 import BeautifulSoup + +driver = webdriver.Chrome() +driver.get(url); +Thread.sleep(1000); + +page_size = 10 +for i in range(page_size): + time.sleep(2) + js = "var q=document.documentElement.scrollTop=10000" + driver.execute_script(js) + +page = BeautifulSoup(driver.page_source, 'lxml') +print(page.text) +``` + +## 选项 + +### A + +``` +以上均不正确 +``` + +### B + +```python +import requests + +response = requests.get(url=url) +page = BeautifulSoup(response.text, 'lxml') +print(page.text) +``` + +### C + +```python +import urllib.request + +response = urllib.request.urlopen(url) +buff = response.read() +html = buff.decode("utf8") +page = BeautifulSoup(html, 'lxml') +print(page.text) +``` diff --git "a/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/11.\346\250\241\346\213\237\347\231\273\345\275\225/config.json" "b/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/11.\346\250\241\346\213\237\347\231\273\345\275\225/config.json" index d8195cd3e8915c0b6a8b6d936af712690f403b2b..f786015b1d2eb6d12aa61aa2523cb028c84fb1b6 100644 --- "a/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/11.\346\250\241\346\213\237\347\231\273\345\275\225/config.json" +++ "b/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/11.\346\250\241\346\213\237\347\231\273\345\275\225/config.json" @@ -1,5 +1,5 @@ { - "export": [], + "export": ["simulate_login.json"], "keywords": [], "children": [ { diff --git "a/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/11.\346\250\241\346\213\237\347\231\273\345\275\225/simulate_login.json" "b/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/11.\346\250\241\346\213\237\347\231\273\345\275\225/simulate_login.json" new file mode 100644 index 0000000000000000000000000000000000000000..859db924fd5a6d955f00a8a5e45683f4b6ae5e05 --- /dev/null +++ "b/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/11.\346\250\241\346\213\237\347\231\273\345\275\225/simulate_login.json" @@ -0,0 +1,6 @@ +{ + "author": "zxm2015", + "source": "simulate_login.md", + "depends": [], + "type": "code_options" +} diff --git "a/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/11.\346\250\241\346\213\237\347\231\273\345\275\225/simulate_login.md" "b/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/11.\346\250\241\346\213\237\347\231\273\345\275\225/simulate_login.md" new file mode 100644 index 0000000000000000000000000000000000000000..7f5b7ce69d157ad61a6d041cc6707c1bad911ce4 --- /dev/null +++ "b/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/11.\346\250\241\346\213\237\347\231\273\345\275\225/simulate_login.md" @@ -0,0 +1,31 @@ +# 模拟登陆 + +一些网站需要登录之后才能浏览网站的其他内容,爬虫需要拥有登录获取cookie/session的能力才能继续采集数据,以下关于说法错误的是: + + + +## 答案 + +``` +登录成功后获取的cookie一般来说永久有效 +``` + +## 选项 + +### A + +``` +模拟登陆需要先注册网站的账号,或者多注册一些账号来维护一个cookies池 +``` + +### B + +``` +获取登录页面,可以从登录按钮处获取到登录的url +``` + +### C + +``` +登录成功后获取到cookie,其他请求带上cookie就可以获取到请求的页面资源 +``` diff --git "a/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/6.Selenium/config.json" "b/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/6.Selenium/config.json" index 3c27a36336db8f0305da2a4fcb2167002d848969..2e36a9e536e237f39c57bde9ee2f28e7e6aa502c 100644 --- "a/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/6.Selenium/config.json" +++ "b/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/6.Selenium/config.json" @@ -1,5 +1,5 @@ { - "export": [], + "export": ["selenium.json"], "keywords": [], "children": [ { diff --git "a/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/6.Selenium/selenium.json" "b/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/6.Selenium/selenium.json" new file mode 100644 index 0000000000000000000000000000000000000000..564aec3150863232a1282e3f551da7adc5056a6d --- /dev/null +++ "b/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/6.Selenium/selenium.json" @@ -0,0 +1,6 @@ +{ + "author": "zxm2015", + "source": "selenium.md", + "depends": [], + "type": "code_options" +} diff --git "a/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/6.Selenium/selenium.md" "b/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/6.Selenium/selenium.md" new file mode 100644 index 0000000000000000000000000000000000000000..d5af05ba47fa21a4afe7bbd9c3c08e284e9cf594 --- /dev/null +++ "b/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/6.Selenium/selenium.md" @@ -0,0 +1,31 @@ +# selenium + +Selenium是web自动化测试工具集,爬虫可以利用其实现对页面动态资源的采集,对于其这种说法错误的是: + + + +## 答案 + +``` +selenium和requests一样,都能用来采集数据,具有同等的速度 +``` + +## 选项 + +### A + +``` +页面执行js才能呈现的内容,可以使用selenium来协助采集 +``` + +### B + +``` +selenium本质是驱动浏览器来发送请求,模拟浏览器的行为 +``` + +### C + +``` +请求之后往往需要等待一段时间,等待资源加载渲染完成 +``` diff --git "a/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/8.pyspider\346\241\206\346\236\266\347\232\204\344\275\277\347\224\250/config.json" "b/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/8.pyspider\346\241\206\346\236\266\347\232\204\344\275\277\347\224\250/config.json" index 6fe9057bb93bbf6d879b021e73e70e3d3175406b..f0c739574b800289be5b742d7dac6be1a175b1af 100644 --- "a/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/8.pyspider\346\241\206\346\236\266\347\232\204\344\275\277\347\224\250/config.json" +++ "b/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/8.pyspider\346\241\206\346\236\266\347\232\204\344\275\277\347\224\250/config.json" @@ -1,5 +1,5 @@ { - "export": [], + "export": ["pyspider.json"], "keywords": [], "children": [ { diff --git "a/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/8.pyspider\346\241\206\346\236\266\347\232\204\344\275\277\347\224\250/pyspider.json" "b/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/8.pyspider\346\241\206\346\236\266\347\232\204\344\275\277\347\224\250/pyspider.json" new file mode 100644 index 0000000000000000000000000000000000000000..3e7130b96af7de55a74cab179c72f6a2e63c55ce --- /dev/null +++ "b/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/8.pyspider\346\241\206\346\236\266\347\232\204\344\275\277\347\224\250/pyspider.json" @@ -0,0 +1,6 @@ +{ + "author": "zxm2015", + "source": "pyspider.md", + "depends": [], + "type": "code_options" +} diff --git "a/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/8.pyspider\346\241\206\346\236\266\347\232\204\344\275\277\347\224\250/pyspider.md" "b/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/8.pyspider\346\241\206\346\236\266\347\232\204\344\275\277\347\224\250/pyspider.md" new file mode 100644 index 0000000000000000000000000000000000000000..0f323a82887e2179cf117153cbd2e19d6658433e --- /dev/null +++ "b/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/8.pyspider\346\241\206\346\236\266\347\232\204\344\275\277\347\224\250/pyspider.md" @@ -0,0 +1,31 @@ +# pyspider + +Pyspider与Scrapy都可以用来爬取数据,关于他们的说法错误的是: + + + +## 答案 + +``` +Scrapy提供了web界面,可以用来调试部署 +``` + +## 选项 + +### A + +``` +Pyspider提供了web界面,可以进行可视化调试 +``` + +### B + +``` +初学者如果想快速入门爬取一个新闻网站,推荐使用Pyspider +``` + +### C + +``` +Scrapy的可扩展程度更高,主要用来应对一些复杂的爬取场景 +``` diff --git "a/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/9.\351\252\214\350\257\201\347\240\201\345\244\204\347\220\206/config.json" "b/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/9.\351\252\214\350\257\201\347\240\201\345\244\204\347\220\206/config.json" index bbb32878ddf20c1b4ddc16360d5339f29653c133..b579bd2e681ab1d93e5571d3e03c233c543ef27d 100644 --- "a/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/9.\351\252\214\350\257\201\347\240\201\345\244\204\347\220\206/config.json" +++ "b/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/9.\351\252\214\350\257\201\347\240\201\345\244\204\347\220\206/config.json" @@ -1,5 +1,5 @@ { - "export": [], + "export": ["verification_code.json"], "keywords": [], "children": [ { diff --git "a/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/9.\351\252\214\350\257\201\347\240\201\345\244\204\347\220\206/verification_code.json" "b/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/9.\351\252\214\350\257\201\347\240\201\345\244\204\347\220\206/verification_code.json" new file mode 100644 index 0000000000000000000000000000000000000000..9820a530dbe3c248d278ab398265d0dc062ee439 --- /dev/null +++ "b/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/9.\351\252\214\350\257\201\347\240\201\345\244\204\347\220\206/verification_code.json" @@ -0,0 +1,6 @@ +{ + "author": "zxm2015", + "source": "verification_code.md", + "depends": [], + "type": "code_options" +} diff --git "a/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/9.\351\252\214\350\257\201\347\240\201\345\244\204\347\220\206/verification_code.md" "b/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/9.\351\252\214\350\257\201\347\240\201\345\244\204\347\220\206/verification_code.md" new file mode 100644 index 0000000000000000000000000000000000000000..81ea22fd8d2a9ce6091b91fb9fe95b321d2ffc16 --- /dev/null +++ "b/data/2.python\344\270\255\351\230\266/3.\347\275\221\347\273\234\347\210\254\350\231\253/9.\351\252\214\350\257\201\347\240\201\345\244\204\347\220\206/verification_code.md" @@ -0,0 +1,31 @@ +# 爬虫验证码 + +验证码是用来区分人和机器的一种方式,以下关于验证码的说法错误的是: + + + +## 答案 + +``` +验证码的识别是一个老话题,已经做到了100%的识别率 +``` + +## 选项 + +### A + +``` +验证码的种类繁多,包括中英混合,点选,滑动等等 +``` + +### B + +``` +验证码识别要使用到OCR(Optical Character Recognition)技术 +``` + +### C + +``` +对于有难度的验证码,可以对接打码平台或者第三方平台提供的识别服务 +```