+ FORMATS = {
+ 'audio': 'mp3',
+ 'video': 'mp4',
+ }
+
+ formats = []
+ for format_tag in ('src', 'hq_src'):
+ video_url = flv_config.get(format_tag)
+ if not video_url:
+ continue
+ format_id = self._search_regex(
+ r'\bq=(.+?)\b', video_url, 'format id', default=format_tag)
+ formats.append({
+ 'url': video_url,
+ 'ext': FORMATS.get(flv_config['type'], 'mp4'),
+ 'format_id': format_id,
+ 'height': int(format_id) if format_id.isnumeric() else None,
+ })
+ self._sort_formats(formats)
+
+ timestamp = flv_config.get('publish_datetime')
+ if timestamp:
+ timestamp = parse_iso8601(timestamp + ' +0800', ' ')
+
+ category = flv_config.get('category')
+ categories = [category] if category else []
+
+ return {