当前位置:网站首页>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
边栏推荐
- Youqilin 22.04 lts version officially released | ukui 3.1 opens a new experience
- Installation and deployment of Flink and wordcount test
- Unity rawimage background seamlessly connected mobile
- Mysql50 basic exercises
- /etc/bash_ completion. D directory function (the user logs in and executes the script under the directory immediately)
- Innovative practice of short video content understanding and generation technology in meituan
- 简单的拖拽物体到物品栏
- Jetpack -- lifecycle usage and source code analysis
- Windows remote connection to redis
- Wechat payment function
猜你喜欢
Installation du compilateur croisé de la plateforme zynq
Recommended scheme of national manufactured electronic components for intelligent electronic scales
CLion+OpenCV identify ID number - detect ID number
Go reflection rule
Installation and use of Apache bench (AB pressure test tool)
The perfect combination of collaborative process and multi process
Spark FAQ sorting - must see before interview
Youqilin 22.04 lts version officially released | ukui 3.1 opens a new experience
Spark optimization
Arduino UNO r3+LCD1602+DHT11
随机推荐
Com alibaba. Common methods of fastjson
POI export message list (including pictures)
Unity3d practical skills - theoretical knowledge base (I)
Innovation training (VI) routing
Leetcode004 -- Roman numeral to integer
Jetpack -- lifecycle usage and source code analysis
What's the difference between error and exception
Improving 3D object detection with channel wise transformer
View analysis of scenic spots in ArcGIS
Pixel mobile phone brick rescue tutorial
Solutions to the failure of sqoop connection to MySQL
leetcode009--用二分查找在数组中搜索目标值
Spark small case - RDD, broadcast
[paper reading] [3D object detection] voxel transformer for 3D object detection
Leetcode006 -- find the longest common prefix in the string array
Excel uses the functions of replacement, sorting and filling to comprehensively sort out financial data
No such file or directory problem while executing shell
Go reflection - go language Bible learning notes
Migrate from MySQL database to AWS dynamodb
Spark FAQ sorting - must see before interview