资源简介

python爬取飞猪机票 采用selenium模拟登陆 使用微博账号登陆淘宝跳转飞猪python爬取飞猪机票

资源截图

代码片段和文件信息

import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from bs4 import BeautifulSoup
import openpyxl

#https://segmentfault.com/a/1190000018494039
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

url = ‘https://login.taobao.com/member/login.jhtml‘

options = webdriver.ChromeOptions()
options.add_experimental_option(“prefs“ {“profile.managed_default_content_settings.images“: 2}) # 不加载图片加快访问速度
options.add_experimental_option(‘excludeSwitches‘ [‘enable-automation‘]) # 此步骤很重要,设置为开发者模式,防止被各大网站识别出来使用了Selenium

weibo_username = ‘‘#填写微博账号
weibo_password = ‘‘#填写微博密码
#实现微博跳转淘宝需要微博绑定淘宝,并且微博无设备锁
browser = webdriver.Chrome(option

评论

共有 条评论