youtube-dl: cant download from qq

Hi I tried:

youtube-dl http://v.qq.com/page/y/i/0/y01647bfni0.html
[generic] y01647bfni0: Requesting header
WARNING: Falling back on generic information extractor.
[generic] y01647bfni0: Downloading webpage
[generic] y01647bfni0: Extracting information
ERROR: Unsupported URL: http://v.qq.com/page/y/i/0/y01647bfni0.html

Supported sites lists some qq sites as supported though.

About this issue

  • Original URL
  • State: open
  • Created 9 years ago
  • Reactions: 3
  • Comments: 26 (1 by maintainers)

Commits related to this issue

Most upvoted comments

Sorry for the delay. I got a WIP work based on @lvqier’s script but it’s far from complete yet: https://github.com/yan12125/youtube-dl/tree/wip-qq

It’s the ckey field.

may be it’s only used in the flash player, i didn’t see any reference to ckey in the html5 requests. i will post the code that i already have in case that someone want to continue working on it(but i think that handling multipart should be fixed before continue working on this):

# coding: utf-8
from __future__ import unicode_literals

import re

from .common import InfoExtractor
from ..utils import (
    int_or_none,
    float_or_none,
)


class QQIE(InfoExtractor):
    _VALID_URL = r'https?://(?:.*\.)?qq\.com/.*?vid=(?P<id>[^&]+)'

    def _real_extract(self, url):
        vid = self._match_id(url)

        def get_json(jsonp):
            return self._search_regex(r'({.*})', jsonp, None)

        video_data = self._download_json(
            'http://h5vv.video.qq.com/getinfo', vid, transform_source=get_json, query={
                'vid': vid,
                'platform': 10201,
                'otype': 'json',
                # 'defn': 'mp4', # default value is mp4, possible values: sd, hd, shd, fhd
            })
        video_info = video_data['vl']['vi'][0]
        title = video_info['ti']
        filename = video_info['fn']
        vkey = video_info['fvkey']
        width = int_or_none(video_info.get('vw'))
        height = int_or_none(video_info.get('vh'))
        server_info = video_info['ul']['ui'][0]
        base_url = server_info['url']
        vt = server_info['vt']
        info = {}
        current_format = next(fi for fi in video_data['fl']['fi'] if fi['sl'] == 1)
        parts = video_info.get('cl', {}).get('ci', [])
        if parts:
            entries = []
            for index, p in enumerate(parts, 1):
                part_filename = re.sub(r'(.*)\.(\w)', r'\1.%d.\2' % index, filename)
                vkey = self._download_json('http://h5vv.video.qq.com/getkey', vid, transform_source=get_json, query={
                    'vid': vid,
                    'platform': 10201,
                    'otype': 'json',
                    'format': current_format['id'],
                    'filename': part_filename,
                    'vt': vt,
                })['key']
                entries.append({
                    'id': '%s_part%d' % (vid, index),
                    'format_id': current_format.get('name'),
                    'title': title,
                    'url': base_url + part_filename + '?vkey=' + vkey,
                    'duration': float_or_none(p.get('cd')),
                    'width': width,
                    'height': height,
                })
            info.update({
                '_type': 'multi_video',
                'entries': entries,
            })
        else:
            info = {
                'format_id': current_format.get('name'),
                'url': base_url + filename + '?vkey=' + vkey,
                'duration': float_or_none(video_info.get('td')),
                'width': width,
                'height': height,
            }
        info.update({
            'id': vid,
            'title': title,
        })
        return info

Hmm. Did you mean the PLAYER_GUID variable? Sounds like the cache system in youtube-dl can help.


Note to myself: https://v.qq.com/x/page/i0137wt2799.html doesn’t work with wip-qq. Seems I over-simplify codes in txsp.py

Ref: soimort/you-get#1685

@yan12125 I have re-licensed my repository, please enjoy it.