mirror of https://github.com/yt-dlp/yt-dlp
[twitter:spaces] Add downloader
cited 56ba5e11cc (diff-a949010439cefd1cf130901ae40a60fc3c33d3e191667b9fc8dc40a58d3e5310R271-R289)
by @ef1500
TODO: Rename the concatenated `.m4a` to `.aac` and then `FixupM4a`
pull/13862/head
parent
23c658b9cb
commit
6a00da4cbe
@ -0,0 +1,15 @@
|
||||
from .hls import HlsFD
|
||||
|
||||
|
||||
class TwitterSpacesFD(HlsFD):
|
||||
FD_NAME = 'twitterspaces'
|
||||
|
||||
def _read_fragment(self, ctx):
|
||||
frag_content = super()._read_fragment(ctx)
|
||||
idx = frag_content.find(bytes(
|
||||
[0x49, 0x44, 0x33, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x50, 0x52, 0x49, 0x56]))
|
||||
if idx > 0:
|
||||
self.to_screen(f'[{self.FD_NAME}] Removing partial header ({idx} bytes)')
|
||||
return frag_content[idx:]
|
||||
else:
|
||||
return frag_content
|
Loading…
Reference in New Issue