python3 回车import requests 回车 respones = requests.get("http://www.52download.cn/wpcourse/?p=9649") 回车print(respones.text) 回车
1.2 请求图片(视频),并且下载print(respones.headers) 回车 print(respones.status_code) 回车headers = {'User-Agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36'} 回车respones = requests.get("http://www.52download.cn/wpcourse/wp-content/uploads/2018/03/coffee.png",headers=headers) 回车with open('/Users/wangyang/Desktop/1.png','wb') as f:..、 f.write(respones.content)..、 f.close()respones = requests.get("https://a.sinaimg.cn/mintra/pic/2112130543/weibo_login.mp4",headers=headers)with open('/Users/wangyang/Desktop/1.mp4','wb') as f:..、 f.write(respones.content)..、 f.close()
from selenium import webdriver driver = webdriver.Chrome()driver.get('http://m.weibo.com')driver.get('http://baidu.com')print(driver.page_source)
注意:如出现这样子的错误:那就要以下解决方法: 2.1、点击看版本 2.2、打开对应的网站:https://registry.npmmirror.com/binary.html?path=chromedriver/
点击下载,对应的zip包