资源简介
下载网页视频并合并(2heiPage.py)
代码片段和文件信息
# coding=gbk
import requests
import os
import sys
from bs4 import BeautifulSoup as bs #beautifulsoup4库使用时是简写的bs4
import timerandom#导入包
import pymysql
import re
from Crypto.Cipher import AES
user_agent_list = [
“Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML like Gecko) Chrome/22.0.1207.1 Safari/537.1“
“Mozilla/5.0 (X11; CrOS i686 2268.111.0) AppleWebKit/536.11 (KHTML like Gecko) Chrome/20.0.1132.57 Safari/536.11“
“Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.6 (KHTML like Gecko) Chrome/20.0.1092.0 Safari/536.6“
“Mozilla/5.0 (Windows NT 6.2) AppleWebKit/536.6 (KHTML like Gecko) Chrome/20.0.1090.0 Safari/536.6“
“Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.1 (KHTML like Gecko) Chrome/19.77.34.5 Safari/537.1“
“Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/536.5 (KHTML like Gecko) Chrome/19.0.1084.9 Safari/536.5“
“Mozilla/5.0 (Windows NT 6.0) AppleWebKit/536.5 (KHTML like Gecko) Chrome/19.0.1084.36 Safari/536.5“
“Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.3 (KHTML like Gecko) Chrome/19.0.1063.0 Safari/536.3“
“Mozilla/5.0 (Windows NT 5.1) AppleWebKit/536.3 (KHTML like Gecko) Chrome/19.0.1063.0 Safari/536.3“
“Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_0) AppleWebKit/536.3 (KHTML like Gecko) Chrome/19.0.1063.0 Safari/536.3“
“Mozilla/5.0 (Windows NT 6.2) AppleWebKit/536.3 (KHTML like Gecko) Chrome/19.0.1062.0 Safari/536.3“
“Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.3 (KHTML like Gecko) Chrome/19.0.1062.0 Safari/536.3“
“Mozilla/5.0 (Windows NT 6.2) AppleWebKit/536.3 (KHTML like Gecko) Chrome/19.0.1061.1 Safari/536.3“
“Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.3 (KHTML like Gecko) Chrome/19.0.1061.1 Safari/536.3“
“Mozilla/5.0 (Windows NT 6.1) AppleWebKit/536.3 (KHTML like Gecko) Chrome/19.0.1061.1 Safari/536.3“
“Mozilla/5.0 (Windows NT 6.2) AppleWebKit/536.3 (KHTML like Gecko) Chrome/19.0.1061.0 Safari/536.3“
“Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.24 (KHTML like Gecko) Chrome/19.0.1055.1 Safari/535.24“
“Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/535.24 (KHTML like Gecko) Chrome/19.0.1055.1 Safari/535.24“
“Mozilla/5.0 (iPhone; CPU iPhone OS 7_1_2 like Mac OS X) App leWebKit/537.51.2 (KHTML like Gecko) Version/7.0 Mobile/11D257 Safari/9537.53“
]
url = sys.argv[1]
#url=‘https://zzzttt04.com/archives/261.html‘
UA=random.choice(user_agent_list) #获取随机的User_Agent
download_header = {
‘User_Agent‘:UA
}
try:
req = requests.get(url headers=download_header stream=Truetimeout=5)
except:
print (‘HTTP请求失败!!!正在准备重发。。。‘)
time.sleep(1)
req = requests.get(url headers=download_header stream=Truetimeout=5)
soup = bs(req.text‘html.parser‘)
title=soup.find(‘title‘).get_text()
title=title.replace(‘ - 黑料不打烊zzzttt.su‘‘‘)
title=title.replace(‘.‘‘‘)
download_path = os.getcwd() +‘\\download\\‘+title #一定要以斜杠(\)结尾
print(‘download_path=‘+download_path)
if not os.path.exists(download_pa
相关资源
- 网页遥控小车 Python web (基于RPi.GPI
- 网易云音乐
- 遍历文件夹中mdb合并到一个GDB中
- python与量化投资-从基础到实战 配套资
- python Tkinter
- 批量文件.py
- 基于10000网页python搭建搜索引擎课程设
- Python3.x+Pyqt5实现界面编程浏览网页
- python网络爬虫爬取整个网页
- Python-Goose3一个用Python编写的文章提取
- OCR:一个有趣的网页版手写数字识别
- get-pip.py下载267386
- 蜻蜓fm文件名还原逆还原工具qtfmr2.e
- python写一个商城网页服务器并且实现
- Python小说器
- 利用python做的一个简单爬虫程序,可
- python+Oracle+Flask+前端网页=爬虫程序
- numpy-1.15.3-cp27-none-win_amd64.whl
- python课件合并.pdf
- python算法图解. 真正完整版.pdf
- Python学生管理系统web网页版
- python+flask+echarts+mysql实现中国疫情数据
- 《Python面向对象编程指南》 高清完整
- pythonweb大作业
- Python-weixinlogin微信网页授权实现扫码
- Python-flask树莓派网页端控制开关灯采
- 神州租车动态网页爬虫源代码python
- python自动抓取网页中的pdf文件
- python爬虫网站图片
- PCA故障诊断python实现
评论
共有 条评论