更新日期: 2021.04.10
本节内容 :
镀金的天空: http://glidedsky.com
一个专供爬虫升级打怪的网站~~
做了基础 1&2 部分,以下是基础 2 部分~
1. 需求描述
爬虫往往不能在一个页面里面获取全部想要的数据,需要访问大量的网页才能够完成任务。
目标网站一个有1000个网页,每个页面有有12个数字,拿到每页上的数据,把这些数字求和。答案正确,即可通关。
2. 代码
- 使用selenium输入用户名和密码,点击登录
- 使用selenium翻页
- 汇总,计算~
from selenium import webdriver
from selenium.webdriver import ChromeOptions
from bs4 import BeautifulSoup
import time
import random
# 配置 driver
my_options = ChromeOptions()
my_options.add_experimental_option('excludeSwitches', ['enable-automation'])
no_image = {
"profile.managed_default_content_settings.images"