def parse_graphql_video(video):
    formats = []
    q = qualities(['sd', 'hd'])
    for (suffix, format_id) in [('', 'sd'), ('_quality_hd', 'hd')]:
        playable_url = video.get(('playable_url' + suffix))
        if (not playable_url):
            continue
        formats.append({'format_id': format_id, 'quality': q(format_id), 'url': playable_url})
    extract_dash_manifest(video, formats)
    process_formats(formats)
    v_id = (video.get('videoId') or video.get('id') or video_id)
    info = {'id': v_id, 'formats': formats, 'thumbnail': try_get(video, (lambda x: x['thumbnailImage']['uri'])), 'uploader_id': try_get(video, (lambda x: x['owner']['id'])), 'timestamp': int_or_none(video.get('publish_time')), 'duration': float_or_none(video.get('playable_duration_in_ms'), 1000)}
    description = try_get(video, (lambda x: x['savable_description']['text']))
    title = video.get('name')
    if title:
        info.update({'title': title, 'description': description})
    else:
        info['title'] = (description or ('Facebook video #%s' % v_id))
    entries.append(info)
def parse_graphql_video(video):
    formats = []
    q = qualities(['sd', 'hd'])
    for (suffix, format_id) in [(, 'sd'), ('_quality_hd', 'hd')]:
        playable_url = video.get(('playable_url' + suffix))
        if (not playable_url):
            continue
        formats.append({'format_id': format_id, 'quality': q(format_id), 'url': playable_url})
    extract_dash_manifest(video, formats)
    process_formats(formats)
    v_id = (video.get('videoId') or video.get('id') or video_id)
    info = {'id': v_id, 'formats': formats, 'thumbnail': try_get(video, (lambda x: x['thumbnailImage']['uri'])), 'uploader_id': try_get(video, (lambda x: x['owner']['id'])), 'timestamp': int_or_none(video.get('publish_time')), 'duration': float_or_none(video.get('playable_duration_in_ms'), 1000)}
    description = try_get(video, (lambda x: x['savable_description']['text']))
    title = video.get('name')
    if title:
        info.update({'title': title, 'description': description})
    else:
        info['title'] = (description or ('Facebook video #%s' % v_id))
    entries.append(info)