Closed rajjys closed 2 years ago
Hi, share please videoId you are trying to get size, code snippet and stacktrace
yeah for example the code
List<VideoFormat> videoList = video.VideoWithAudioFormat();
for(var it : videoList){
System.out.println(it.height + "p" + "has size:" + it.contentLength() + "Mb");
////this throws NPE
}
What i want to display is something like
144p has size 28Mb
360p has size 38Mb
720p has size 50Mb
and so on, but contentLength()
throw null
which version of java-youtube-downloader do you use? And also share your videoId, because I just tested on random video and it works for me
yeah version is 3.1.0.
For all videos i just tested i got this
144p has 2983948 bytes
360p has 4922939 bytes
720p has null bytes
///Probably the one throwing NPE
I wonder maybe I'm using this wrong but for many videoId like these for example:
https://www.youtube.com/watch?v=LcrnbWhlE0c
https://www.youtube.com/watch?v=rddozSfttT4
https://www.youtube.com/watch?v=TaQwW5eQZeY
(haha i love 50Cent by the way)
I get a false
response from response.ok()
with this error:
com.github.kiulian.downloader.YoutubeException$BadPageException: streamingData not found
Maybe i should open another issue for the next one i see on HD and 4K videos
like these: https://www.youtube.com/watch?v=mkggXE5e2yk
, https://www.youtube.com/watch?v=LXb3EKWsInQ
is
Error parsing format: unknown itag 701
Error parsing format: unknown itag 700
Error parsing format: unknown itag 699
Error parsing format: unknown itag 698
Error parsing format: unknown itag 697
Error parsing format: unknown itag 696
Error parsing format: unknown itag 695
Error parsing format: unknown itag 694
yes, I can see, that for some formats contentLength is absent in youtube metadata, in such case you can get approximate size like this: bitrate / 8 * approxDurationMs / 1000 = size in bytes
I can't reproduce streamingData not found
exception on those videos you shared, it could be your side problem, like network issue, or youtube blocks scrapping and send you not the original webpage
Regarding new formats and itag you can open new issue and help me investigate it, thank you
I will open another issue.
But the com.github.kiulian.downloader.YoutubeException$BadPageException: streamingData not found
is due to my location, apparently the videos they are blocked for my country or location idk. I used a vpn on top and it worked.
Thanks
Hi brother! is it possible to know the size of each video/audio format object? I've tried with
Format.ContentLength()
but it throwsNull Pointer Exception
fromAudioFormat
orVideoFormat