|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 Stubborn 于 2019-5-30 18:44 编辑
已经失效
- # -*- coding: utf-8 -*-
- # @Time : 2019-04-20 14:33
- # @Author : Ein
- '''
- 代码分析篇
- 关于解析一些vip视频,得到播放地址
- 源自:https://cloud.tencent.com/developer/article/1405161
- 目标分析这个URL:http://www.dayunbo.com/v/
- '''
- import requests
- import re
- import json
- class VIP(object):
- def __init__(self,url):
- self.api = "http://y.mt2t.com/lines?url="
- self.post_url = "http://y.mt2t.com/lines/getdata"
- #url
- self.url = url#
- self.get_videourl = 'http://y2.mt2t.com:91/ifr/api'
- def run(self):
- res = requests.get(self.api+self.url)
- html = res.text
- key = re.search(r'key:"(.*?)"',html).group(1)
- return key
- def url_spilt(self,url):
- 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
- 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)
- if __name__ == '__main__':
- url = "http://v.youku.com/v_show/id_XNDA0MDg2NzU0OA==.html?spm=a2h03.8164468.2069780.5"
- vip = VIP(url=url)
- vip.get_playlist()
复制代码
- {'url': 'https://videos5.jsyunbf.com/2019/02/07/iQX7y3p1dleAhIv7/playlist.m3u8', 'ext': 'dplay', 'msg': 'ok', 'playertype': None, 'param': None}
- {'url': 'https://videos5.jsyunbf.com/2019/02/07/iQX7y3p1dleAhIv7/playlist.m3u8', 'ext': 'hls', 'msg': 'ok', 'playertype': None, 'param': None}
- {'url': 'http://ugcsjy.qq.com/www/w0029ucwjfu.mp4?vkey=DD667531F00BC0C39157FE5994229880F26F7AC8EA28FE356D039F53A88E5E162CCD48645828FAADDEE374976328A4820B38C40525D37C63AD8208D3F06957BDAC38AB4D82C2152F62A42E949B641452DEBD1A42FF81811271233985EAF7D5D7B3E2F9DF4EA5DB19', 'ext': 'dplay', 'msg': 'ok', 'playertype': None, 'param': None}
- {'url': 'https://www.juhui600.com/20190207/CqKVmOPK/index.m3u8', 'ext': 'dm3u8', 'msg': 'ok', 'playertype': None, 'param': None}
- {'url': None, 'ext': None, 'msg': '若长时间仍未播放,请点击右上角换线更换播放线路', 'playertype': None, 'param': None}
- {'url': '//dd.tt-hk.cn/temp2/c06271d8970a116e64e18a510bbc873b-OTI1N3pWYnZzKy9OOEI4N05scTcwZFE0cmJPOWkwY3U4Zk1GWHlMVGUvby8zTFVpQzhJSWY2WVdTbFJrY2N2ZXJMOGxMaFZNeDVWZFdNeTJtRFBxclhJWEkwZ0lyelJRN3J3dHVUdis=.m3u8', 'ext': 'm3u8', 'msg': 'ok', 'playertype': None, 'param': None}
- {'url': '//dd.tt-hk.cn/temp2/c06271d8970a116e64e18a510bbc873b-ZTgwNFpicG0wT2k1SHIwWVB3enVjaFVBNTB4UHhMYzNtRDhtRlVxZDc0N3d6K1hlNUt5Y3ZHYXNLVVdjYjUyZm1IaFpsWThSeDB5cko4aHVQcWtpcGtZeUpCOFRpWnd4RElpK3FwQmRKcHM=.m3u8', 'ext': 'm3u8', 'msg': 'ok', 'playertype': None, 'param': None}
复制代码 |
|