当前位置:网站首页>Innovation training (XII) reptile
Innovation training (XII) reptile
2022-04-23 04:46:00 【Scattered moon】
Introduction to reptiles
- requests+bs4
- selenium+geckodriver
- scrapy frame
Mac install geckodriver
brew install geckodriver
Setup profile ~/.bash_profile file
export path
import requests
from bs4 import BeautifulSoup
url = "https://b2c.csair.com/B2C40/newTrips/static/main/page/booking/index.html?t=S&c1=BJS&c2=SHA&d1=2021-04-20&at=1&ct=0&it=0&b1=PEK-PKX&b2=SHA-PVG"
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36'}
r = requests.get(url, headers=headers)
r.encoding = 'UTF-8'
soup = BeautifulSoup(r.text, "html.parser")
title = soup.find("title").text
print(title)
from selenium import webdriver
driver = webdriver.Firefox(executable_path=r'geckodriver')
url = "https://b2c.csair.com/B2C40/newTrips/static/main/page/booking/index.html?t=S&c1=BJS&c2=SHA&d1=2021-04-20&at=1&ct=0&it=0&b1=PEK-PKX&b2=SHA-PVG"
driver.get(url)
print(driver.page_source)
comment = driver.find_element_by_css_selector('div.zls-flplace')
content = comment.find_element_by_class_name('zls-flplace')
print(content.text)
版权声明
本文为[Scattered moon]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220555418591.html
边栏推荐
- win10, mysql-8.0.26-winx64. Zip installation
- Spark optimization
- Mysql, binlog log query
- leetcode004--罗马数字转整数
- test
- Detailed explanation of life cycle component of jetpack
- zynq平臺交叉編譯器的安裝
- Huawei machine test -- high precision integer addition
- Open the past and let's start over.
- New terminal play method: script guidance independent of technology stack
猜你喜欢
Spark small case - RDD, spark SQL
Eight misunderstandings that should be avoided in data visualization
Summary of Android development posts I interviewed in those years (attached test questions + answer analysis)
Unity RawImage背景无缝连接移动
Recommended scheme for national production of electronic components of wireless keyboard
Wechat payment function
程序员抱怨:1万2的工资我真的活不下去了,网友:我3千咋说
Flink's important basics
Inverse system of RC low pass filter
Excel protects worksheets and workbooks from damage
随机推荐
What is the thirty-six plan
io. Platform. packageRoot; // ignore: deprecated_ Member_ use
補:注解(Annotation)
简单的拖拽物体到物品栏
Differences among electric drill, electric hammer and electric pick
Installation and use of Apache bench (AB pressure test tool)
Unity攝像頭跟隨鼠標旋轉
C language: spoof games
View analysis of scenic spots in ArcGIS
Com alibaba. Common methods of fastjson
List remove an element
Migrate from MySQL database to AWS dynamodb
Coinbase: basic knowledge, facts and statistics about cross chain bridge
Huawei machine test -- high precision integer addition
QML advanced (V) - realize all kinds of cool special effects through particle simulation system
No such file or directory problem while executing shell
Leetcode003 -- judge whether an integer is a palindrome number
Mysql, binlog log query
Innovation training (V) configuration information
Error occurs when thymeleaf th: value is null