The lib is unable to see tag 140 which is present
Opened this issue · 4 comments
➜ go-get-youtube -id=NTHz9ephYTw -itag 140 -rename -mp3
Hold on ...
ID : NTHz9ephYTw
Title : Kar Gayi Chull - Kapoor & Sons | Sidharth Malhotra | Alia Bhatt | Badshah | Amaal Mallik |Fazilpuria
Author : Sony Music India
Views : 204661302
Rating : 4.601755
Formats
0 Itag 22: hd720 video/mp4; codecs="avc1.64001F, mp4a.40.2"
1 Itag 43: medium video/webm; codecs="vp8.0, vorbis"
2 Itag 18: medium video/mp4; codecs="avc1.42001E, mp4a.40.2"
3 Itag 36: small video/3gpp; codecs="mp4v.20.3, mp4a.40.2"
4 Itag 17: small video/3gpp; codecs="mp4v.20.3, mp4a.40.2"
Unknown Itag number: 140
Whereas the output from ytdl shows otherwise
➜ ./ytdl -j 'https://www.youtube.com/watch?v=NTHz9ephYTw' | jq ".formats"
[
{
"itag": 22,
"extension": "mp4",
"resolution": "720p",
"videoEncoding": "H.264",
"audioEncoding": "aac",
"audioBitrate": 192
},
{
"itag": 43,
"extension": "webm",
"resolution": "360p",
"videoEncoding": "VP8",
"audioEncoding": "vorbis",
"audioBitrate": 128
},
{
"itag": 18,
"extension": "mp4",
"resolution": "360p",
"videoEncoding": "H.264",
"audioEncoding": "aac",
"audioBitrate": 96
},
{
"itag": 36,
"extension": "3gp",
"resolution": "240p",
"videoEncoding": "MPEG-4 Visual",
"audioEncoding": "aac",
"audioBitrate": 36
},
{
"itag": 17,
"extension": "3gp",
"resolution": "144p",
"videoEncoding": "MPEG-4 Visual",
"audioEncoding": "aac",
"audioBitrate": 24
},
{
"itag": 137,
"extension": "mp4",
"resolution": "1080p",
"videoEncoding": "H.264",
"audioEncoding": "",
"audioBitrate": 0
},
{
"itag": 248,
"extension": "webm",
"resolution": "1080p",
"videoEncoding": "VP9",
"audioEncoding": "",
"audioBitrate": 9
},
{
"itag": 136,
"extension": "mp4",
"resolution": "720p",
"videoEncoding": "H.264",
"audioEncoding": "",
"audioBitrate": 0
},
{
"itag": 247,
"extension": "webm",
"resolution": "720p",
"videoEncoding": "VP9",
"audioEncoding": "",
"audioBitrate": 0
},
{
"itag": 135,
"extension": "mp4",
"resolution": "480p",
"videoEncoding": "H.264",
"audioEncoding": "",
"audioBitrate": 0
},
{
"itag": 244,
"extension": "webm",
"resolution": "480p",
"videoEncoding": "VP9",
"audioEncoding": "",
"audioBitrate": 0
},
{
"itag": 134,
"extension": "mp4",
"resolution": "360p",
"videoEncoding": "H.264",
"audioEncoding": "",
"audioBitrate": 0
},
{
"itag": 243,
"extension": "webm",
"resolution": "360p",
"videoEncoding": "VP9",
"audioEncoding": "",
"audioBitrate": 0
},
{
"itag": 133,
"extension": "mp4",
"resolution": "240p",
"videoEncoding": "H.264",
"audioEncoding": "",
"audioBitrate": 0
},
{
"itag": 242,
"extension": "webm",
"resolution": "240p",
"videoEncoding": "VP9",
"audioEncoding": "",
"audioBitrate": 0
},
{
"itag": 160,
"extension": "mp4",
"resolution": "144p",
"videoEncoding": "H.264",
"audioEncoding": "",
"audioBitrate": 0
},
{
"itag": 278,
"extension": "webm",
"resolution": "144p",
"videoEncoding": "VP9",
"audioEncoding": "",
"audioBitrate": 0
},
{
"itag": 140,
"extension": "mp4",
"resolution": "",
"videoEncoding": "",
"audioEncoding": "aac",
"audioBitrate": 128
},
{
"itag": 171,
"extension": "webm",
"resolution": "",
"videoEncoding": "",
"audioEncoding": "vorbis",
"audioBitrate": 128
},
{
"itag": 249,
"extension": "webm",
"resolution": "",
"videoEncoding": "",
"audioEncoding": "opus",
"audioBitrate": 50
},
{
"itag": 250,
"extension": "webm",
"resolution": "",
"videoEncoding": "",
"audioEncoding": "opus",
"audioBitrate": 70
},
{
"itag": 251,
"extension": "webm",
"resolution": "",
"videoEncoding": "",
"audioEncoding": "opus",
"audioBitrate": 160
}
]
ITag parser appears to be working correctly:
import urllib2
import urlparse
id = 'NTHz9ephYTw'
url = "http://www.youtube.com/get_video_info?&video_id="+ id
body = urllib2.urlopen(url).read()
query = urlparse.parse_qs(body)
stream_map = query['url_encoded_fmt_stream_map'][0]
stream_map_query = urlparse.parse_qs(stream_map)
itag = stream_map_query['itag']
print 'itags:', itag
Output:
itags: ['22', '43', '18', '36', '17']
Hi @dbatbold If you see the output from ytdl in my previous post (reposted below stripping out other unwanted details) you can see that there are more itags..
➜ bin ./ytdl -j 'https://www.youtube.com/watch?v=NTHz9ephYTw' | jq "[ .formats[].itag ]"
[
22,
43,
18,
36,
17,
137,
248,
136,
247,
135,
244,
134,
243,
133,
242,
160,
278,
140,
171,
249,
250,
251
]
Looks like ITag numbers are hard coded in https://github.com/rylio/ytdl/blob/master/format.go#L81 file.
The returned ['22', '43', '18', '36', '17']
tags are available formats that YouTube currently has for the specific video. The ytdl
tool is showing the formats that can be requested from YouTube, but it doesn't mean they have all the formats available.
If it did that i shouldn't be able to download right ? But i am able to..
Also Assuming the ytdl code is wrong.. I Tested that with time tested youtube-dl as given below
➜ bin youtube-dl -f 140 'https://www.youtube.com/watch?v=NTHz9ephYTw'
[youtube] NTHz9ephYTw: Downloading webpage
[youtube] NTHz9ephYTw: Downloading video info webpage
[youtube] NTHz9ephYTw: Extracting video information
[download] Resuming download at byte 261120
[download] Destination: Kar Gayi Chull - Kapoor & Sons _ Sidharth Malhotra _ Alia Bhatt _ Badshah _ Amaal Mallik _Fazilpuria-NTHz9ephYTw.m4a
[download] 100% of 2.15MiB in 00:02
[ffmpeg] Correcting container in "Kar Gayi Chull - Kapoor & Sons _ Sidharth Malhotra _ Alia Bhatt _ Badshah _ Amaal Mallik _Fazilpuria-NTHz9ephYTw.m4a"
As you can see itag 140 corresponds to m4a format