diff options
author | James Taylor <user234683@users.noreply.github.com> | 2021-08-17 17:58:17 -0700 |
---|---|---|
committer | Jesús <heckyel@hyperbola.info> | 2021-08-29 18:44:26 -0500 |
commit | d56df02e7b1eba86baf511289208295b1f6c5a50 (patch) | |
tree | 2083e8db6f479676a969fe13bda3a6c9cfcbc114 /youtube/yt_data_extract | |
parent | 0c106bb1110f8c1f75b77bdd65a5ecdff4135680 (diff) | |
download | yt-local-d56df02e7b1eba86baf511289208295b1f6c5a50.tar.lz yt-local-d56df02e7b1eba86baf511289208295b1f6c5a50.tar.xz yt-local-d56df02e7b1eba86baf511289208295b1f6c5a50.zip |
Add support for more qualities, merging video+audio using MSE
Signed-off-by: Jesús <heckyel@hyperbola.info>
Diffstat (limited to 'youtube/yt_data_extract')
-rw-r--r-- | youtube/yt_data_extract/watch_extraction.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/youtube/yt_data_extract/watch_extraction.py b/youtube/yt_data_extract/watch_extraction.py index b3d3cb4..43be909 100644 --- a/youtube/yt_data_extract/watch_extraction.py +++ b/youtube/yt_data_extract/watch_extraction.py @@ -415,13 +415,21 @@ def _extract_formats(info, player_response): fmt['itag'] = itag fmt['ext'] = None fmt['audio_bitrate'] = None + fmt['bitrate'] = yt_fmt.get('bitrate') fmt['acodec'] = None fmt['vcodec'] = None fmt['width'] = yt_fmt.get('width') fmt['height'] = yt_fmt.get('height') fmt['file_size'] = yt_fmt.get('contentLength') - fmt['audio_sample_rate'] = yt_fmt.get('audioSampleRate') + fmt['audio_sample_rate'] = extract_int(yt_fmt.get('audioSampleRate')) + fmt['duration_ms'] = yt_fmt.get('approxDurationMs') fmt['fps'] = yt_fmt.get('fps') + fmt['init_range'] = yt_fmt.get('initRange') + fmt['index_range'] = yt_fmt.get('indexRange') + for key in ('init_range', 'index_range'): + if fmt[key]: + fmt[key]['start'] = int(fmt[key]['start']) + fmt[key]['end'] = int(fmt[key]['end']) update_format_with_type_info(fmt, yt_fmt) cipher = dict(urllib.parse.parse_qsl(multi_get(yt_fmt, 'cipher', 'signatureCipher', default=''))) @@ -459,7 +467,7 @@ def extract_hls_formats(hls_manifest): if lines[i].startswith('#EXT-X-STREAM-INF'): fmt = {'acodec': None, 'vcodec': None, 'height': None, 'width': None, 'fps': None, 'audio_bitrate': None, - 'itag': None, 'file_size': None, + 'itag': None, 'file_size': None, 'duration_ms': None, 'audio_sample_rate': None, 'url': None} properties = lines[i].split(':')[1] properties += ',' # make regex work for last key-value pair |