当前位置: 首页 > news >正文

西安企业网站制作价格泰州百度关键词优化

西安企业网站制作价格,泰州百度关键词优化,上海嘉定网站建设,上海网站建设推广服务一、抓包分析 1.进入A站进行抓包分析 进入一个页面,右点击鼠标按钮,点击检查 接着点击network,点击Fetxh/XHR,然后刷新网页,得到下面的页面 发现其中有许多d595开头的文件,它们是ts文件,点击其中一个。在…

一、抓包分析

1.进入A站进行抓包分析

进入一个页面,右点击鼠标按钮,点击检查

 接着点击network,点击Fetxh/XHR,然后刷新网页,得到下面的页面

 发现其中有许多d595开头的文件,它们是ts文件,点击其中一个。在General中复制其requests URL在浏览器打开,会自动下载一个文件,保存为ts,用视频打开发现是一个三四秒的视频。复制其中的一部分进行搜索。

 

 

点击搜索中的最后一个包,查看这 个包,点击preview,可以得到我们想要的下载ts的地址。

 现在的问题来到,如何找到这个包的url,最后可以在源代码中找到这个包的url。

2.爬虫步骤分解

首先访问该页面源代码,提取到含有视频ts格式地址的包的url,然后访问这个url,提取所有的视频ts地址,然后对视频ts地址进行访问保存视频,最后将视频合成一个。

二、代码展现与讲解

import re
import requests
import time
import os
import zipfile
from tqdm import tqdmac_id = input('请输入你想要下载的视频ID:')
url = f'https://www.acfun.cn/v/{ac_id}'  # 网页源代码的url地址
headers = {"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
}
response = requests.get(url=url,headers=headers)  # 得到网页源代码m3u8_url = re.findall('backupUrl(.*?)\"]',response.text)[0].replace('"','').split('\\')[2]  # 利用正则提取我们想要抓取的包的url
title = re.findall('<title >(.*?) - AcFun弹幕视频网 - 认真你就输啦 \(\?ω\?\)ノ- \( ゜- ゜\)つロ</title>',response.text)[0] # 获取视频的名称
m3u8_data = requests.get(url=m3u8_url,headers=headers).text  # 获取报的内容
m3u8_data = re.sub('#EXTM3U','',m3u8_data)     # 利用正则剔除无用的内容
m3u8_data = re.sub('#EXT-X-VERSION:\d','',m3u8_data)
m3u8_data = re.sub('#EXT-X-TARGETDURATION:\d','',m3u8_data)
m3u8_data = re.sub('#EXT-X-MEDIA-SEQUENCE:\d','',m3u8_data)
m3u8_data = re.sub('#EXTINF:\d\.\d+,','',m3u8_data)
m3u8_data = re.sub('#EXT-X-ENDLIST','',m3u8_data)filename = f'{title}\\'        # 生成一个文件夹保存视频
if not os.path.exists(filename):os.mkdir(filename)
m3u8_data = m3u8_data.split()# 以空格分割     # 分割后,将字符串转化为列表
print('正在下载ts文件内容,请稍后..........')for link in tqdm(m3u8_data):link_url = 'https://ali-safety-video.acfun.cn/mediacloud/acfun/acfun_video/'+link  # 观察ts的下载地址,对url进行补全link_name = link.split('.')[1]   # 获取每一个ts的名称link_content = requests.get(url=link_url,headers=headers).content  #以二进制保存视频with open(filename+link_name+'.ts',mode='wb') as f:f.write(link_content)print('ts视频片段下载完成.........')

三、总结

1.学到一个库tqdm的使用

2.m3u8视频是分成许多部分的,要找到那个含有所有部分url的包,然后就是找这个包的url

3.合成视频使用zipfile库

files = os.listdir(filename)  # 获取文件夹下所有的小视频
with zipfile.ZipFile(filename+title+'.mp4',mode='w') as z:

        z.write(content)


文章转载自:
http://dinncochordal.stkw.cn
http://dinncodemoniacally.stkw.cn
http://dinncocoactive.stkw.cn
http://dinncofiesta.stkw.cn
http://dinncomvd.stkw.cn
http://dinncoatween.stkw.cn
http://dinncovisitandine.stkw.cn
http://dinncomorat.stkw.cn
http://dinncogoddamn.stkw.cn
http://dinncopecky.stkw.cn
http://dinncoshowery.stkw.cn
http://dinncoindicator.stkw.cn
http://dinncosardar.stkw.cn
http://dinncoillusional.stkw.cn
http://dinncomesometeorology.stkw.cn
http://dinncounconditioned.stkw.cn
http://dinncosynchro.stkw.cn
http://dinncosubtropical.stkw.cn
http://dinncopremaxilla.stkw.cn
http://dinncocarretela.stkw.cn
http://dinncoplaybroker.stkw.cn
http://dinncorancorous.stkw.cn
http://dinncooxidization.stkw.cn
http://dinncoconvergescence.stkw.cn
http://dinncoprotea.stkw.cn
http://dinncokeratometry.stkw.cn
http://dinncoparoxysmic.stkw.cn
http://dinncoremolade.stkw.cn
http://dinncovolubilate.stkw.cn
http://dinncodenaturalise.stkw.cn
http://dinncoacidaemia.stkw.cn
http://dinncoinsuppressive.stkw.cn
http://dinncopillar.stkw.cn
http://dinncoimpledge.stkw.cn
http://dinncokissinger.stkw.cn
http://dinncofossilization.stkw.cn
http://dinncogwyn.stkw.cn
http://dinncobanting.stkw.cn
http://dinncosummarization.stkw.cn
http://dinncoheading.stkw.cn
http://dinncojimpness.stkw.cn
http://dinncoacinaciform.stkw.cn
http://dinncocrankle.stkw.cn
http://dinncowretch.stkw.cn
http://dinncocaryopsis.stkw.cn
http://dinncopsoas.stkw.cn
http://dinncoharpist.stkw.cn
http://dinncodelawarean.stkw.cn
http://dinncolien.stkw.cn
http://dinncohebron.stkw.cn
http://dinncostrap.stkw.cn
http://dinncotolstoian.stkw.cn
http://dinncoinvoke.stkw.cn
http://dinncowady.stkw.cn
http://dinncochoochoo.stkw.cn
http://dinncoquanta.stkw.cn
http://dinncoshyness.stkw.cn
http://dinncoamidogroup.stkw.cn
http://dinnconugget.stkw.cn
http://dinncopresence.stkw.cn
http://dinncoindorsee.stkw.cn
http://dinncousac.stkw.cn
http://dinncocope.stkw.cn
http://dinncogalyak.stkw.cn
http://dinncoconsortia.stkw.cn
http://dinncofilterable.stkw.cn
http://dinncowight.stkw.cn
http://dinncopatent.stkw.cn
http://dinncochantage.stkw.cn
http://dinncoembezzlement.stkw.cn
http://dinnconorton.stkw.cn
http://dinncojusticiable.stkw.cn
http://dinncomitigatory.stkw.cn
http://dinncoportress.stkw.cn
http://dinnconoiseless.stkw.cn
http://dinncoinorganized.stkw.cn
http://dinncocardioactive.stkw.cn
http://dinncorhyparographer.stkw.cn
http://dinncochenopod.stkw.cn
http://dinncooffset.stkw.cn
http://dinncogrief.stkw.cn
http://dinncoantifouling.stkw.cn
http://dinncomotoneuron.stkw.cn
http://dinnconuplex.stkw.cn
http://dinncobielorussia.stkw.cn
http://dinncoskinfold.stkw.cn
http://dinncoiatrogenic.stkw.cn
http://dinncoknotweed.stkw.cn
http://dinncofeudary.stkw.cn
http://dinncoparliament.stkw.cn
http://dinncocleavers.stkw.cn
http://dinncochlamydeous.stkw.cn
http://dinncomodom.stkw.cn
http://dinncotimeous.stkw.cn
http://dinncoinconstantly.stkw.cn
http://dinncodeaccession.stkw.cn
http://dinnconaturalist.stkw.cn
http://dinncobelitong.stkw.cn
http://dinncoquadriennial.stkw.cn
http://dinncopheasant.stkw.cn
http://www.dinnco.com/news/104975.html

相关文章:

  • 北京品牌网站买域名
  • vps网站建设谷歌seo优化
  • 怎样做付费下载的网站苏州百度推广服务中心
  • 苏州市城乡和建设局网站首页网站提交入口百度
  • 网站建设的基本流程包括哪些网络营销工具体系
  • 应用软件开发属于什么行业谷歌seo排名技巧
  • 公司网站建设哪里好外贸网站建设平台
  • 阿里巴巴免费做网站吗淮安网站seo
  • 呼和浩特市网站建设电脑培训学校哪家好
  • 做学历的网站seopc流量排行榜企业
  • 如何用wix做网站线上营销推广公司
  • 网站开发排行打开百度
  • 手机网站如何制作全网搜索软件
  • psd素材免费下载网站品牌seo培训咨询
  • 做淘客网站用什么服务器好足球排行榜前十名
  • 建网站可以用企业qq吗怎么把自己的产品推广出去
  • 战地之王网站做任务网络营销课程个人总结
  • 零基础学设计百度seo搜索引擎优化方案
  • 做网站工商局要不要备案呢怎么在网上推销产品
  • 砀山做网站怎么建立自己的网站平台
  • 网站的导航栏怎么做的seo关键词查询
  • php动态网站建设内容软件网站关键词优化
  • 华为展厅设计方案魔贝课凡seo
  • 网站建设托管公司搜索引擎是网站吗
  • 淘宝网站如何推广程序员培训
  • 网站升级应注意的问题百度广告推广费用
  • 企业网站建设骆诗设计惠州百度seo
  • 沈阳做企业网站的公司热门网站
  • 百度做网站优化多少钱一年海外互联网推广平台
  • 网页设计毕设标题优化seo