设为首页 加入收藏

TOP

Python爬虫入门教程 50-100 Python3爬虫爬取VIP视频-Python爬虫6操作(二)
2019-03-15 10:07:57 】 浏览:97
Tags:Python 爬虫 入门教程 50-100 Python3 VIP 视频 -Python 操作
Q4Vnv7gUk%2bSpJYws4A93QjxcuTflk7RojJt0PiXpBkTAdXtRa6%2bLAY%3d&type=m3u8" url_param = url.split("?url=")[1].split("&")[0].replace("%2b","+").replace("%3d","=").replace("%2f","/") if "type=" in url: type = url.split("type=")[1] else: type = "" return url_param,type

完善get_playlist函数,最终的代码如下

    def get_playlist(self):

        key = self.run()

        data = {
            "url":self.url,
            "key":key
        }
        html = requests.post(self.post_url,data=data).text
        dic = json.loads(html)

        for item in dic:
            url_param, type = self.url_spilt(item["Url"])
            res = requests.post(self.get_videourl,data={
                "url":url_param,
                "type":type,
                "from": "mt2t.com",
                "device":"",
                "up":"0"
            })
            play = json.loads(res.text)
            print(play)

运行之后得到下面的提示,其中最重要的m3u8已经成果获取到,完成任务
python3图片爬虫
python3图片爬虫

首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇Python学习之一 下一篇Python爬虫6-利用ProxyHandler设..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目