腾讯视频的地址解析下载

作者: Maslino | 来源:发表于2016-11-13 14:16 被阅读27187次

    以腾讯视频播放页地址http://v.qq.com/x/cover/rz4mhb6494f12co.html为例,说说如何解析得到视频的真实地址。

    提取视频ID

    在播放页源码中,可以找到如下视频信息:

    var VIDEO_INFO = {
        title: "咱们相爱吧 第1集",
        duration: "2746",
        vid: "y00221a60w7",
        piantou:"0",
        pianwei:"0",
        showMark:"1",
        showBullet:true,
        showImageBullet:false,
        openBulletDefault:true,
        isNeedPay: false,
        isTrailer: 0,
        singlePrice: "undefined",
        vipPrice: "undefined",
        tryTime: "1306029",
        isTrailer : 0,
        type: "2"
    };
    

    其中,vid的值y00221a60w7即为视频ID.

    请求getinfo接口

    使用Chrome浏览器的开发者工具监控网络请求,发现getinfo接口的请求地址如下:

    http://h5vv.video.qq.com/getinfo?callback=txplayerJsonpCallBack_getinfo_591513&isHLS=false&charge=0&vid=y00221a60w7&defn=hd&defnpayver=1&otype=json&guid=29a06bf3852fbe2ea6eb53829c3878fa&platform=10901&sdtfrom=v1010&host=v.qq.com&_rnd=1479010822&fhdswitch=0&show1080p=1&_qv_rmt=sNk0sWZTA17002uQa%3D&_qv_rmt2=0Qs65I9%2B149182HOQ%3D&_=1479010820769
    

    我们尝试构造各个请求参数,然后看看请求结果是什么样子的。

    params = {
        'isHLS': False,
        'charge': 0,
        'vid': 'y00221a60w7',
        'defn': 'shd',
        'defnpayver': 1,
        'otype': 'json',
        'platform': 10901,
        'sdtfrom': 'v1010',
        'host': 'v.qq.com',
        'fhdswitch': 0,
        'show1080p': 1,
    }
    

    参数中的defn为清晰度标识,可选值有sd(标清)、hd(高清)、shd(超清)、fhd(1080P)。请求结果如下:

    {
      "dltype": 1,
      "exem": 0,
      "fl": {
        "cnt": 4,
        "fi": [
          {
            "br": 20000,
            "cname": "高清;(480P)",
            "fs": 239935872,
            "id": 10412,
            "lmt": 0,
            "name": "hd",
            "sb": 1,
            "sl": 0
          },
          {
            "br": 500000,
            "cname": "蓝光;(1080P)",
            "fs": 1064110139,
            "id": 10409,
            "lmt": 1,
            "name": "fhd",
            "sb": 1,
            "sl": 0
          },
          {
            "br": 64,
            "cname": "标清;(270P)",
            "fs": 114567499,
            "id": 10403,
            "lmt": 0,
            "name": "sd",
            "sb": 1,
            "sl": 0
          },
          {
            "br": 500000,
            "cname": "超清;(720P)",
            "fs": 468471925,
            "id": 10401,
            "lmt": 0,
            "name": "shd",
            "sb": 1,
            "sl": 1
          }
        ]
      },
      "hs": 0,
      "ls": 0,
      "preview": 2746,
      "s": "o",
      "sfl": {
        "cnt": 0
      },
      "tm": 1479014650,
      "vl": {
        "cnt": 1,
        "vi": [
          {
            "br": 166,
            "ch": 0,
            "cl": {
              "ci": [
                {
                  "cd": "300.032",
                  "cmd5": "285464ac33c56b14caa63c466d4b4ed3",
                  "cs": 56516869,
                  "idx": 1,
                  "keyid": "y00221a60w7.10401.1"
                },
                {
                  "cd": "299.988",
                  "cmd5": "6a9b0dedeb2ed7c73e5ad31418a9a6bc",
                  "cs": 56364414,
                  "idx": 2,
                  "keyid": "y00221a60w7.10401.2"
                },
                {
                  "cd": "299.988",
                  "cmd5": "2181237427075dc219de8bdaa37ae64d",
                  "cs": 50213590,
                  "idx": 3,
                  "keyid": "y00221a60w7.10401.3"
                },
                {
                  "cd": "299.988",
                  "cmd5": "ac17519a98640a1926f54bc48f5637fb",
                  "cs": 37593039,
                  "idx": 4,
                  "keyid": "y00221a60w7.10401.4"
                },
                {
                  "cd": "300.032",
                  "cmd5": "546963ed0dcb3544373e8642eb2bb166",
                  "cs": 54082931,
                  "idx": 5,
                  "keyid": "y00221a60w7.10401.5"
                },
                {
                  "cd": "299.988",
                  "cmd5": "f33ed88e9b94d4cb1c9c0fb5d3730f76",
                  "cs": 43686678,
                  "idx": 6,
                  "keyid": "y00221a60w7.10401.6"
                },
                {
                  "cd": "299.988",
                  "cmd5": "a6a298f6122de6c09080ae78639c139c",
                  "cs": 40800986,
                  "idx": 7,
                  "keyid": "y00221a60w7.10401.7"
                },
                {
                  "cd": "299.988",
                  "cmd5": "9454b637e3c913ebd1c880ac5e6cf973",
                  "cs": 62436368,
                  "idx": 8,
                  "keyid": "y00221a60w7.10401.8"
                },
                {
                  "cd": "346.837",
                  "cmd5": "0fe50a2165b1ef7860627dbaf672d493",
                  "cs": 68478324,
                  "idx": 9,
                  "keyid": "y00221a60w7.10401.9"
                }
              ],
              "fc": 9
            },
            "ct": 21600,
            "drm": 0,
            "dsb": 0,
            "fclip": 1,
            "fmd5": "18f937a9790f22a843e618fb5fd02583",
            "fn": "y00221a60w7.p401.mp4",
            "fs": 468471925,
            "fst": 5,
            "fvkey": "88980E6001844B3B7D98195D7077A1EA62310E41BD70C43F57AC6E80AFEB8E9EFD71201CBBB054F2CBFEC5EA8269BB141DB6933322FAA43AD3BB6AA62AD9FE2C2B2A321A639497AA6DF23492CF3B622E41A1C5C75F2DDEC7",
            "hevc": 0,
            "iflag": 0,
            "level": 0,
            "lnk": "y00221a60w7",
            "logo": 1,
            "pl": [
              {
                "cnt": 2,
                "pd": [
                  {
                    "c": 10,
                    "cd": 10,
                    "fmt": 40001,
                    "fn": "q1",
                    "h": 45,
                    "r": 10,
                    "url": "http://video.qpic.cn/video_caps/0/",
                    "w": 80
                  },
                  {
                    "c": 5,
                    "cd": 10,
                    "fmt": 40002,
                    "fn": "q2",
                    "h": 90,
                    "r": 5,
                    "url": "http://video.qpic.cn/video_caps/0/",
                    "w": 160
                  }
                ]
              }
            ],
            "share": 1,
            "sp": 0,
            "st": 2,
            "td": "2746.84",
            "ti": "咱们相爱吧_01",
            "type": 1136,
            "ul": {
              "ui": [
                {
                  "dt": 2,
                  "dtc": 10,
                  "url": "http://124.193.165.208/vlive.qqvideo.tc.qq.com/",
                  "vt": 203
                },
                {
                  "dt": 2,
                  "dtc": 10,
                  "url": "http://124.193.165.209/vlive.qqvideo.tc.qq.com/",
                  "vt": 203
                },
                {
                  "dt": 2,
                  "dtc": 10,
                  "url": "http://124.193.165.210/vlive.qqvideo.tc.qq.com/",
                  "vt": 203
                },
                {
                  "dt": 2,
                  "dtc": 10,
                  "url": "http://video.dispatch.tc.qq.com/27099043/",
                  "vt": 0
                }
              ]
            },
            "vh": 720,
            "vid": "y00221a60w7",
            "videotype": 2,
            "vst": 2,
            "vw": 1280
          }
        ]
      }
    }
    

    我们感兴趣的有三个列表:fi列表、ci列表、ui列表。

    • ui列表中的url是视频真实地址的前缀,选择ui列表第一个元素中的url即可。
    • fi列表列出了各个视频码流,每一项中的id是码流的编号,这个参数在后面会用到。
    • ci列表列出了各个分段的相关信息,各个分段信息中的keyid在后面会用到。

    请求getkey接口

    同样,在网络请求监测中发现getkey接口的请求是这样的:

    http://h5vv.video.qq.com/getkey?callback=txplayerJsonpCallBack_getkey_931033&&otype=json&vid=y00221a60w7&format=10401&filename=y00221a60w7.p401.4.mp4&platform=10901&vt=203&charge=0&_rnd=1479015483148&_=1479015476641
    

    构造参数如下:

    params = {
        'otype': 'json',
        'vid': 'y00221a60w7',
        'format': 10401,
        'filename': 'y00221a60w7.p401.4.mp4',
        'platform': 10901,
        'vt': 217,
        'charge': 0,
    }
    

    参数中的vid为视频ID,format为码流的编号,filename根据分段信息中的keyid得来。以第四个分段为例,说说如何构造filename参数。第四个分段信息中的keyid为y00221a60w7.10401.4,我们将keyid中间的.10替换为.p,然后在末尾加上.mp4即可。

    getkey接口的请求结果示例如下:

    {
      "br": 125315.14,
      "ct": 21600,
      "filename": "y00221a60w7.p401.mp4",
      "key": "AE6DC4B022C2A29C59D1A8E942787A2A54F64A5ABFCA7C99B51BD6539703D4F745DD2D77C3433ACAF1961BBFB6D84C1C717D23BEDCAF4DABC0D8BA2229F6C3464F59F0A10C5ED4CC25E355D9171DC65D411D6834BCA2DECD",
      "keyid": "y00221a60w7.10401.4",
      "level": 0,
      "levelvalid": 1,
      "s": "o",
      "sp": 0,
      "sr": 0
    }
    

    看!key粗来了。

    构造视频真实地址

    通过网络监测发现视频真实地址是像这样的:

    http://60.206.195.15/vlive.qqvideo.tc.qq.com/y00221a60w7.p401.4.mp4?sdtfrom=v1010&guid=29a06bf3852fbe2ea6eb53829c3878fa&vkey=6C5D63159598E6D217BA73F6F3335C0B80CECE2A4E889AFCDD8A391DB9C648059731AE9AD47BDA03B016F76E8B59D9DF0C2373CA32A4ADB935AEE0FE73ECE1C460DC01F6B733A5F38035AC289C44721F606C1ADF5AED4267
    

    分析该地址的构造,不难发现,地址前缀在前面的ui列表中已经得到了,filename也计算出来了,vkey参数就是上面得到的key.

    Python代码示例

    import requests
    import json
    
    vid = 'y00221a60w7' # replace with your vid
    for definition in ('shd', 'hd', 'sd'):
        params = {
            'isHLS': False,
            'charge': 0,
            'vid': vid,
            'defn': definition,
            'defnpayver': 1,
            'otype': 'json',
            'platform': 10901,
            'sdtfrom': 'v1010',
            'host': 'v.qq.com',
            'fhdswitch': 0,
            'show1080p': 1,
        }
        r = requests.get('http://h5vv.video.qq.com/getinfo', params=params)
        data = json.loads(r.content[len('QZOutputJson='):-1])
    
        url_prefix = data['vl']['vi'][0]['ul']['ui'][0]['url']
        for stream in data['fl']['fi']:
            if stream['name'] != definition:
                continue
            stream_id = stream['id']
            urls = []
            for d in data['vl']['vi'][0]['cl']['ci']:
                keyid = d['keyid']
                filename = keyid.replace('.10', '.p', 1) + '.mp4'
                params = {
                    'otype': 'json',
                    'vid': vid,
                    'format': stream_id,
                    'filename': filename,
                    'platform': 10901,
                    'vt': 217,
                    'charge': 0,
                }
                r = requests.get('http://h5vv.video.qq.com/getkey', params=params)
                data = json.loads(r.content[len('QZOutputJson='):-1])
                url = '%s/%s?sdtfrom=v1010&vkey=%s' % (url_prefix, filename, data['key'])
                urls.append(url)
    
            print 'stream:', stream['name']
            for url in urls:
                print url
    

    运行输出如下:

    stream: shd
    http://124.193.165.208/vlive.qqvideo.tc.qq.com//y00221a60w7.p401.1.mp4?sdtfrom=v1010&vkey=539A9C083D166365C28AFDD0A858C40FC53B82044321F0DC3117D11CDAEAB12FABC79042408ED04502D2EB26C2CFDBB6B3B550888DC2E6F92A4B7897CBE3430BDF4E753BF67D27972208A1FDFD15486D612AB3A9E985F0D3
    http://124.193.165.208/vlive.qqvideo.tc.qq.com//y00221a60w7.p401.2.mp4?sdtfrom=v1010&vkey=D9041825DC880EE7665E7EEBD0731093A2393590172810A3DA8473126E7E02779ED07F608107B5E49F08580DA6CE63BF2FBF38E737C0F651BCB6FA5929E70D14E86EDC36B9CB1109553D57C1CD3E1282CF62C0DE0BD0B3B8
    http://124.193.165.208/vlive.qqvideo.tc.qq.com//y00221a60w7.p401.3.mp4?sdtfrom=v1010&vkey=E4FD79F9EF72E97BD2263DC7E7BF2FE6EC8C64560E691680C7474E5820730BD679D01E36E03AE7758AADAE900DDDA6CE8CAB0E6334913297FD7E47A28AC6EECA64BBB843652AAE6BB7CEC0E9B27F3EAF00423E2171C9C805
    http://124.193.165.208/vlive.qqvideo.tc.qq.com//y00221a60w7.p401.4.mp4?sdtfrom=v1010&vkey=EBEC5493738D777E1F0CC301DE464B3C86A9A8F795C6B9EC16D11E37C4C4858D00A5C50F7B93F6FFFAD11E33393525B41F7E637FAFC1E0466426A2ED83312D8B7BF32AFAAABFA80A306EDA1052FC8916C05D715B97BDB7B3
    http://124.193.165.208/vlive.qqvideo.tc.qq.com//y00221a60w7.p401.5.mp4?sdtfrom=v1010&vkey=86B99347160E24D4CE9602F0C7BE2413873CF07C9404BF7D543630F2AB52626B5E2F320989EB394F242613749F6BB605507DFBC781880D2455121B038FE83345484393E03A93C6974F22EED1461219AD5D2BA2E53E10E203
    http://124.193.165.208/vlive.qqvideo.tc.qq.com//y00221a60w7.p401.6.mp4?sdtfrom=v1010&vkey=C36989A32739197FE18F3DECE39A2D0F602D84AB5024FD822DFE184FDC26C18F086AA8BB195C670BBE2616C54ABB24DEB3B2AFB7D7EF8D50ACA77220750EEEB1C4AEF151098E1AAA5E903982F2F097A0B63BDF382E213243
    http://124.193.165.208/vlive.qqvideo.tc.qq.com//y00221a60w7.p401.7.mp4?sdtfrom=v1010&vkey=2A87824E55E660ACAE20802CFAB9D54A5C4A244EDC194B3424D5DEF7D391F0D9E50DD0D741A3DFA169CA533436F99E9817394FE66E12ADD64AE3B18F75069C3F3B2C6D83CB2E32B4A545DBEDF139DE23A0F03A1B1606B2D2
    http://124.193.165.208/vlive.qqvideo.tc.qq.com//y00221a60w7.p401.8.mp4?sdtfrom=v1010&vkey=7A02829EF2FC539EB3B448108665A100FD2F55920CCD51751FF125CA5E390FE36BDD0FE6256C774E18020A038F1CA35FE1E5BF06CBCB93E9E57E39EC486300E590E804868355AC77265AE057FFDB8DC799AE2453EC588844
    http://124.193.165.208/vlive.qqvideo.tc.qq.com//y00221a60w7.p401.9.mp4?sdtfrom=v1010&vkey=91AAB3F5A6C93BCA628FCBE710280F032591DE6C85DB069582C2AB6ABA1F30096A3B4EAEC750C8807B422D1FCC1FC8B18C98B056A1F4B9FCD5371DEA4F47130530D902FE95647FEE70F98C9D86AE89E96AB6688DB5200226
    stream: hd
    http://124.193.230.15/vlive.qqvideo.tc.qq.com//y00221a60w7.p412.1.mp4?sdtfrom=v1010&vkey=E27946F5763CD1A7B3BFDDE1DC17EBF9F65CC6767D70E1E7D57E34556C2558A8ABCE6D9FD16F812CEEC46D788474F6C820421D9B97C0EC2D689439991AA314990FE50C1648E5419CF38FAA11FC71460EA669EABB347B77EC
    http://124.193.230.15/vlive.qqvideo.tc.qq.com//y00221a60w7.p412.2.mp4?sdtfrom=v1010&vkey=A937071AAD7AEF30C86817F88A12699C26921D3058329069CEC4D10F91669BAE9246DC60DC7A8DBD159AA7C1EDABF3DCC47113BC25AF38200A9D2636D2782F4399319BFAAC152C0081AAEC11594D58153F4B33ADA4F810F5
    http://124.193.230.15/vlive.qqvideo.tc.qq.com//y00221a60w7.p412.3.mp4?sdtfrom=v1010&vkey=ECF097D838E75DF1D85FF40F037022BD54C53515F31C45F36076DAA2951D2002E367577015171E29D3B012B0F6355673871AC1902A849F43B56FA0C5154CF871B454EEC46830700126654B7F3CC3955B27F5180D1028984F
    http://124.193.230.15/vlive.qqvideo.tc.qq.com//y00221a60w7.p412.4.mp4?sdtfrom=v1010&vkey=1F222CC2857D9D0B6B259B4A657FBCE278E87DAEC79AE15C9A78A84093D68DD68172C2AEED25C23F54C373A44B6CB0003F97ADAA4591CA556839348C5135975F3B7C223346384AE476392D373FBA66BD4026C1F76D7D6BDD
    http://124.193.230.15/vlive.qqvideo.tc.qq.com//y00221a60w7.p412.5.mp4?sdtfrom=v1010&vkey=35CFC97BBA528A56B63B868C1E0FDBF63DA80DEFB2E82DE5F9ECD723BA2900379565E1A25AB52F8079C9392B6FCE1C4C05A385066857AB03B08B1502818CECBCF919890CD64C96B0260E0E441BBE73F643AD7DF51523A30C
    http://124.193.230.15/vlive.qqvideo.tc.qq.com//y00221a60w7.p412.6.mp4?sdtfrom=v1010&vkey=4C66C574DE904ADC8C348540CDEAC961A0EBE6E63759E8AD8E6F9BAC6F57A2CB7E66161376C70AAF7A44ECCFE1849EB485E0F3151B814F86B7FDC6E2146954F066EE2DB1CA9916C84CF2C033358DFC2F7437373697C161D3
    http://124.193.230.15/vlive.qqvideo.tc.qq.com//y00221a60w7.p412.7.mp4?sdtfrom=v1010&vkey=68D340AD704C1E8D1DB969F5CBB37448D918CEDBAD774147E0AF3E46168707FF37FDC4F8245259BF8B2DF70DBBEEE717CC161A06867B0C45C51D638C6034046DF9DA71842507CDECCDDBF13B949DFE984DA8EFF818470BF5
    http://124.193.230.15/vlive.qqvideo.tc.qq.com//y00221a60w7.p412.8.mp4?sdtfrom=v1010&vkey=71AE0C8C193091ECC938ABE73325C50C3A415025DCA213797C73371A68947DA7BCD9F76CBEE1098FBD328A352C32BE80F0BCED45869A908AAF51DA780AEE9523B29BAF0CAB388AF194EA72C69D6BAA679DB0EF2385A1E17D
    http://124.193.230.15/vlive.qqvideo.tc.qq.com//y00221a60w7.p412.9.mp4?sdtfrom=v1010&vkey=393D1585DFAEEF8259EE5408C864AD9022FCFB33A8A937013E614F53129AEF12D46162893DC7804CBBB38558E90FD72D0914D08450C08536D15637DD143BD054CF002766A80C989AE583B2CFC39BC308DC54D9C0E9D66F10
    stream: sd
    http://124.193.230.156/vlive.qqvideo.tc.qq.com//y00221a60w7.p403.1.mp4?sdtfrom=v1010&vkey=56E9F7C96D6FFD3394017519AF0C09B560536F3918B19BFB2B94FBDDBBA07D2ED14185908C5D459AC1F722A52AC35193B5FB8D1ECDC2663DE03EF106F8AD2B37332361A10E5F3CDCF4EA3A8018A08ACF59E230DEFACF7864
    http://124.193.230.156/vlive.qqvideo.tc.qq.com//y00221a60w7.p403.2.mp4?sdtfrom=v1010&vkey=72EEDB6A0631AFC0F8439FDD31BECA0AEBC2EF496F7B5F5D32693C2F1F6F8768468CDD1A434181552CAD6276205A3C2C0ACBEA1B13A5A1C9CB7A9986170E402D77219A271C86797F3704155B9426D6BEF1134445BC9F02B6
    http://124.193.230.156/vlive.qqvideo.tc.qq.com//y00221a60w7.p403.3.mp4?sdtfrom=v1010&vkey=7FD8C0EEC450673A18F72E2616D1F9EEB120F384A1E392FBDFBDA6E60A82F9B5292A77D6C3325C596A6058FE145E11A37E244150A4884F491627D50826A55E432BCC49CAC8B75350C4FADEDB7613CE66DF0628ADB0EBDED5
    http://124.193.230.156/vlive.qqvideo.tc.qq.com//y00221a60w7.p403.4.mp4?sdtfrom=v1010&vkey=8F677851AF4261295A84C69478D961816CC5C92E9B42495D8E0BDBF35B96C7F0D2AA688B6956011E5ED6A933764F9130A0B73215A23FBA083433123F161AEF447400E1BD8D450665E7278561D3284BE2EB0819D9C47DDAB3
    http://124.193.230.156/vlive.qqvideo.tc.qq.com//y00221a60w7.p403.5.mp4?sdtfrom=v1010&vkey=17FC7F5BF0D3B66E2C6F99C17617EBBE79ADE0B94C89BAF2FE06EE086829669D89D6A31EBB094FB4F8CA731C5E5B55823948F565B815AB2E37D9CDE294812687B76922A0DACBFA2DCA94D6EE6D6E64BE188F605537918FCF
    http://124.193.230.156/vlive.qqvideo.tc.qq.com//y00221a60w7.p403.6.mp4?sdtfrom=v1010&vkey=73CD3396A1FD375A1E03D11662A28EEF160B48FE45CCBB21F730C3CCC46D7FC4EA1EF02C784D30BBCAFD68453841A55CCC318FEBB55E555F2ADE1F093997ED256B2F68E1BF81A4AA35F63EDF330E733552899D868C02D960
    http://124.193.230.156/vlive.qqvideo.tc.qq.com//y00221a60w7.p403.7.mp4?sdtfrom=v1010&vkey=3CABA633B9235147A6B12D48AB97E23CA279B9DE1ED3F56D2D1408333A09AF2691BE540E5CA844D819045A7FCE44988692C9D8E330C718C904500B09390F90E6939C789544A3592361A1E756981892D27459065377FFA8B1
    http://124.193.230.156/vlive.qqvideo.tc.qq.com//y00221a60w7.p403.8.mp4?sdtfrom=v1010&vkey=097BB6E06309CED825B05AAFA361B16888D351D8C4EFE75BABA25D216F3271464447C5C54B378DC25A0AFD7B15740F2A071E03310647D7EB8744EE6DF99DCFB736CCB086E3F7D52E87FB0DF0A73EFF74C8D22947CB9476D7
    http://124.193.230.156/vlive.qqvideo.tc.qq.com//y00221a60w7.p403.9.mp4?sdtfrom=v1010&vkey=1E1174EEF8848D4C1B5823C41357D8DB822AF848E74DDA112546D59BAD71AF7B9D10AB2127A90F0CD76FCA1FE5E6011E087CC3DF9D996552DDBE29EB08903639DF94F2ED8B52C8807B6FA3521E4D7CC96B2A6A7A7782C052
    

    相关文章

      网友评论

      • cuiwei110:这个解析视频的地址是怎么分析呀,我不知道分析方法是什么
      • 天策通宝:嗯 思路不错 :+1:
      • 阿信yo:谢谢分享,这个是不需要会员就可以直接解析得到真实地址吗?
        Maslino:@Mr乔_113c 文中方法已经失效了。不能解析出会员视频
      • 艺灵设计:补充下昨天的评论,原来那个只是5分钟的,vip视频地址并不能这么轻易搞到,头大。。。。
        Maslino:@艺灵设计 是啊
      • 艺灵设计:大神,今天又是一天折腾,文章中提到的接口可以访问,但参数拼接好像还是有点问题,页面刷新后key会不停的变化,实际上key值不应该变化才对,我拼接的路径会将完整的视频分成若干断mp4播放,求大神指点。q:315800015,大神一起研究呗。忘记说了,昨天那个芒果TV的,vip视频跟普通视频操作一样,已顺利过关。
      • Jackect:我在寻找腾讯视频直接下载的方法时看到了这篇文章,虽然已经被和谐了,但思路非常好,值得学习,另外刚刚我自己发现了一种方法直接得到解析地址。
        当启用了腾讯视频的HTML5播放器播放视频时鼠标右键点击复制调试信息,粘贴到记事本,就会惊讶地发现视频地址。
        例如:https://v.qq.com/x/page/h03767nz1vz.html
        得到的调试信息:{"pid":"eff8984d246…(此处省略部分字符)……"vurl":"http%3A%2F%2F123.138.114.28%2Fvhot2.qqvideo.tc.qq.com%2FAHzfH-v9Yp6zbxYP0_JxymYco0T3NhJk3p6M2ocasv7w%2Fh03767nz1vz.p701.1.mp4%3Fsdtfrom%3Dv1010%26guid%3D1a4ea6fbc5c6300df3ecbfa5953d54c6%26vkey%3DDC101D8945E57ED1FCEFD6204EC3DDA9CC6CE2634E8BCB59706F7F23FD2C0182FA5ECFA9BC8CFD73FDD7594C7D6DAB7C56426584EDE2387751BF7F10A248C00DFD3FFE379DA9D455E2C2C0BDAC7A5FA179D560C8D3D0043E616E313098CA5310E5A1D67206BED91C76C1182B1DFB8961D4BA52DA81E3C7EF","cid":"","now":"2017-11-20 21:14:38","defn":"shd","uid":"1a4ea6fbc5c6300df3ecbfa5953d54c6"}
        这里的vurl就是MP4视频地址,有的视频是m3u8(可以从中获取到ts分段视频的地址)。

        希望作者您根据我提供的信息完善一下腾讯视频的地址解析下载。(其实我就是想等你做出新的py下载脚本)
        艺灵设计:可行是可行,就是遇到m3u8的就比较蛋疼了,全分段了。。。
        Jackect:@Maslino 这个不会
        Maslino:@Jackect 你看看能否模拟浏览器点击行为得到上述信息
      • 亦鸣惊人:太厉害了,一直在找这方面的文章,居然偶然看到了,写得太好了!
      • 201709020221:淘宝视频怎么下载
        艺灵设计:/p/1/e/1/t, 把e和t之间的数据换成6或7即可下载。完整版教程地址:http://www.yilingsj.com/code/2016-07-13/421.html
      • 42e1dd428f25:厉害了 我的歌
      • 未末星空:带上VIP的cookie解析出来可能就不会限速了。
        未末星空:@Maslino 是的,已经改好了。建议登录了vip账号后抓包,然后有token之类的,再模拟下然后链接应该就不会限速了
        Maslino: @未末星空 你用的Python3?
        未末星空:
        运行到data = json.loads(r.content[len('QZOutputJson='):-1])
        这里报错
        TypeError: the JSON object must be str, not 'bytes'
        用的是python3.5,网上说要加.decode
        但是不知道怎么改,要在py3岁用的话该怎么写呢?
      • AlistairChow:请问1080P的地址怎么解析?我用上面的规则貌似不行,调用getkey接口时报vid和filename错误
        Maslino: @AlistairChow 文中的方法已经失效了
      • 暴风鸟:测试了下,腾讯已限速... 20kb/s.。。
        Maslino: @8163baec6308 是的
      • a0070de5e83a:getkey接口的url我在chrome的开发者工具里一直没有检测到啊,你是怎么得到的?
        我的User-Agent:Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B137 Safari/601.1
        Maslino:@MathJoy 用本文中的流程解析出来的地址,下载的时候很慢。所以这个解析流程需要更新了。
        a0070de5e83a:@Maslino 但是那个getkey接口的url现在依然有效
        Maslino:这篇文章写于去年11月份,文中的解析流程可能已经失效。
      • a0070de5e83a:你是怎么知道defn为清晰度标识并且知道可选值有sd(标清)、hd(高清)、shd(超清)、fhd(1080P)?
        Maslino:@MathJoy 一般我们期望解析出最高码流,低码流可以不用关心。遇到2K、4K码流的时候再加上其它可选值就行了。
        a0070de5e83a:@Maslino 谢谢,果然不同凡响!我想问的是你怎么确定可选值就只有那几个呢?保证无遗漏了?
        Maslino:getinfo接口的返回结果中有这个对应关系。此外,也可以推测出来,defn是definition的简写;sd、hd、shd、fhd分别是standard definition、high definition、super high definition、full high difinition的简写。
      • a0070de5e83a:大神你是切换UA让视频以html5播放器播放的吧?
        Maslino:@MathJoy 是的
        a0070de5e83a:@Maslino 你用的是macOS?
        Maslino:没有切换UA。Chrome桌面浏览器打开腾讯视频就是用HTML5播放的。

      本文标题:腾讯视频的地址解析下载

      本文链接:https://www.haomeiwen.com/subject/tqlcpttx.html

      热点阅读