IamEld3st / youtube_dash_dl

MIT License
46 stars 8 forks source link

inspect more of the mimeType field #22

Closed aerickson closed 2 years ago

aerickson commented 2 years ago

I was getting a stack when listing streams for the video mentioned below. It turned out to be due to a 'application/x-rawcc' mimeTyped representation.

Solution: Inspect up to the '/' in the mimeType.

Thank you for creating this tool. It's the only one I could find that could make a clip of a YouTube livestream.

stack on main:

$ yt_ddl https://www.youtube.com/watch\?v\=g0p5Swb0bL0 -l 
Traceback (most recent call last):
  File "/Users/aerickson/yt_grady_test/ytdash/venv/bin/yt_ddl", line 33, in <module>
    sys.exit(load_entry_point('youtube-dash-dl', 'console_scripts', 'yt_ddl')())
  File "/Users/aerickson/yt_grady_test/ytdash/venv/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/Users/aerickson/yt_grady_test/ytdash/venv/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/Users/aerickson/yt_grady_test/ytdash/venv/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/aerickson/yt_grady_test/ytdash/venv/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/Users/aerickson/yt_grady_test/youtube_dash_dl/yt_ddl/yt_ddl.py", line 278, in main
    a, v, m, s, l = process_mpd(mpd_data)
  File "/Users/aerickson/yt_grady_test/youtube_dash_dl/yt_ddl/yt_ddl.py", line 105, in process_mpd
    quality = r.attrib["audioSamplingRate"]
  File "src/lxml/etree.pyx", line 2494, in lxml.etree._Attrib.__getitem__
KeyError: 'audioSamplingRate'

With this PR:

$ yt_ddl https://www.youtube.com/watch\?v\=g0p5Swb0bL0 -l
You can go back 899 hours and 28 minutes...
Download avaliable from 2022-03-28 16:07:31.582616

Audio stream ids
0:      44100 Bitrate:   144000 Codec: mp4a.40.2
1:      22050 Bitrate:    64000 Codec: mp4a.40.5

Video stream ids
0:  1920x1080 Bitrate:  5018593 Codec: avc1.640028
1:   1280x720 Bitrate:  2684050 Codec: avc1.4d401f
2:  1920x1080 Bitrate:  1816000 Codec: vp9
3:    854x480 Bitrate:  1350025 Codec: avc1.4d401f
4:   1280x720 Bitrate:  1040000 Codec: vp9
5:    640x360 Bitrate:  1008250 Codec: avc1.4d401e
6:    854x480 Bitrate:   528000 Codec: vp9
7:    426x240 Bitrate:   456228 Codec: avc1.4d4015
8:    640x360 Bitrate:   292000 Codec: vp9
9:    256x144 Bitrate:   212465 Codec: avc1.42c00b
10:    426x240 Bitrate:   166000 Codec: vp9
11:    256x144 Bitrate:   111000 Codec: vp9
IamEld3st commented 2 years ago

Hi, looks good... Would you mind bumping the version to 1.0.9 in setup.py? Thanks

aerickson commented 2 years ago

Great. :)

Version incremented.

Please let me know if you'd like this rebased into a single commit.

IamEld3st commented 2 years ago

No its okay github does it by itself 👍