sealedtx / java-youtube-downloader

Simple, almost zero-dependency java parser for retrieving youtube video metadata
Other
413 stars 115 forks source link

Playlist Fetching Errors #69

Closed Shabinder closed 3 years ago

Shabinder commented 3 years ago

for instance for following playlist _https://youtube.com/playlist?list=PL4o29bINVT4EG_y-k5jGoOu3-Am8Nvi10_ here, ID: PL4o29bINVT4EG_y-k5jGoOu3-Am8Nvi10

ERROR: W/System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.alibaba.fastjson.JSONObject.getString(java.lang.String)' on a null object reference 2021-01-02 17:51:01.476 32073-5327/com.shabinder.spotiflyer W/System.err: at com.github.kiulian.downloader.model.AbstractVideoDetails.(AbstractVideoDetails.java:28) 2021-01-02 17:51:01.476 32073-5327/com.shabinder.spotiflyer W/System.err: at com.github.kiulian.downloader.model.playlist.PlaylistVideoDetails.(PlaylistVideoDetails.java:19) 2021-01-02 17:51:01.476 32073-5327/com.shabinder.spotiflyer W/System.err: at com.github.kiulian.downloader.parser.DefaultParser.populatePlaylist(DefaultParser.java:354) 2021-01-02 17:51:01.476 32073-5327/com.shabinder.spotiflyer W/System.err: at com.github.kiulian.downloader.parser.DefaultParser.getPlaylistVideos(DefaultParser.java:271) 2021-01-02 17:51:01.476 32073-5327/com.shabinder.spotiflyer W/System.err: at com.github.kiulian.downloader.YoutubeDownloader.getPlaylist(YoutubeDownloader.java:70) 2021-01-02 17:51:01.476 32073-5327/com.shabinder.spotiflyer W/System.err: at com.shabinder.spotiflyer.providers.YoutubeProviderKt.getYTPlaylist(YoutubeProvider.kt:94) 2021-01-02 17:51:01.476 32073-5327/com.shabinder.spotiflyer W/System.err: at com.shabinder.spotiflyer.providers.YoutubeProviderKt.queryYoutube(YoutubeProvider.kt:52) 2021-01-02 17:51:01.476 32073-5327/com.shabinder.spotiflyer W/System.err: at com.shabinder.spotiflyer.ui.tracklist.TrackListKt$TrackList$1.invokeSuspend(TrackList.kt:63) 2021-01-02 17:51:01.476 32073-5327/com.shabinder.spotiflyer W/System.err: at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) 2021-01-02 17:51:01.476 32073-5327/com.shabinder.spotiflyer W/System.err: at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) 2021-01-02 17:51:01.476 32073-5327/com.shabinder.spotiflyer W/System.err: at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571) 2021-01-02 17:51:01.476 32073-5327/com.shabinder.spotiflyer W/System.err: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) 2021-01-02 17:51:01.476 32073-5327/com.shabinder.spotiflyer W/System.err: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678) 2021-01-02 17:51:01.476 32073-5327/com.shabinder.spotiflyer W/System.err: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)

sealedtx commented 3 years ago

@Shabinder Just tested your playlist - everything seems ok. Please, check it again and provide your code snippet if error appears

Shabinder commented 3 years ago

https://youtube.com/playlist?list=RD3JsKx4OP8ow ERROR IS Occuring for all playlists

                log("YT Playlist", searchId) :->  D/YT Playlist: RD3JsKx4OP8ow
                val playlist = ytDownloader.getPlaylist(searchId)
                val playlistDetails = playlist.details()
                val name = playlistDetails.title()

ERROR Stack Trace:
W/System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'com.alibaba.fastjson.JSONObject com.alibaba.fastjson.JSONObject.getJSONObject(java.lang.String)' on a null object reference
2021-01-03 03:19:06.391 5384-11821/com.shabinder.spotiflyer W/System.err:     at com.github.kiulian.downloader.parser.DefaultParser.getPlaylistDetails(DefaultParser.java:221)
2021-01-03 03:19:06.391 5384-11821/com.shabinder.spotiflyer W/System.err:     at com.github.kiulian.downloader.YoutubeDownloader.getPlaylist(YoutubeDownloader.java:68)
2021-01-03 03:19:06.391 5384-11821/com.shabinder.spotiflyer W/System.err:     at com.shabinder.spotiflyer.providers.YoutubeProvider.getYTPlaylist(YoutubeProvider.kt:105)
2021-01-03 03:19:06.391 5384-11821/com.shabinder.spotiflyer W/System.err:     at com.shabinder.spotiflyer.providers.YoutubeProvider.queryYoutube(YoutubeProvider.kt:69)
2021-01-03 03:19:06.391 5384-11821/com.shabinder.spotiflyer W/System.err:     at com.shabinder.spotiflyer.ui.tracklist.TrackListKt$TrackList$1.invokeSuspend(TrackList.kt:69)
2021-01-03 03:19:06.391 5384-11821/com.shabinder.spotiflyer W/System.err:     at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
2021-01-03 03:19:06.391 5384-11821/com.shabinder.spotiflyer W/System.err:     at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
2021-01-03 03:19:06.391 5384-11821/com.shabinder.spotiflyer W/System.err:     at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
2021-01-03 03:19:06.391 5384-11821/com.shabinder.spotiflyer W/System.err:     at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
2021-01-03 03:19:06.391 5384-11821/com.shabinder.spotiflyer W/System.err:     at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
2021-01-03 03:19:06.391 5384-11821/com.shabinder.spotiflyer W/System.err:     at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)

from stackTrace Error Seems from JSON Parsing.
sealedtx commented 3 years ago

@Shabinder Your url returns:

This playlist type is unviewable.

Thats why it fails to parse json response. I may add additional checks for such bad pages, but common playlists should work fine, check it, please

Shabinder commented 3 years ago

@sealedtx Yeah , I tried that playlist is not viewable.

For me some are working and some Aren't

like this works: https://www.youtube.com/playlist?list=PLMRKdK25AuPVu7vuwjDm2yobPuZS8hiiO

but this Doesn't: https://www.youtube.com/playlist?list=RDCLAK5uy_nwqiuZ17rDNJGTtN-ihrJNLPyl1XWh-7c


ERROR:
 2021-01-04 17:40:04.604 7621-13750/? D/YT Playlist: RDCLAK5uy_nwqiuZ17rDNJGTtN-ihrJNLPyl1XWh-7c
2021-01-04 17:40:05.230 7621-13750/? W/System.err: java.lang.NumberFormatException: For input string: ""
2021-01-04 17:40:05.231 7621-13750/? W/System.err:     at java.lang.Integer.parseInt(Integer.java:627)
2021-01-04 17:40:05.231 7621-13750/? W/System.err:     at java.lang.Integer.parseInt(Integer.java:650)
2021-01-04 17:40:05.231 7621-13750/? W/System.err:     at com.github.kiulian.downloader.parser.DefaultParser.extractNumber(DefaultParser.java:408)
2021-01-04 17:40:05.231 7621-13750/? W/System.err:     at com.github.kiulian.downloader.parser.DefaultParser.getPlaylistDetails(DefaultParser.java:241)
2021-01-04 17:40:05.231 7621-13750/? W/System.err:     at com.github.kiulian.downloader.YoutubeDownloader.getPlaylist(YoutubeDownloader.java:68)
2021-01-04 17:40:05.231 7621-13750/? W/System.err:     at com.shabinder.spotiflyer.providers.YoutubeProvider.getYTPlaylist(YoutubeProvider.kt:89)
2021-01-04 17:40:05.231 7621-13750/? W/System.err:     at com.shabinder.spotiflyer.providers.YoutubeProvider.query(YoutubeProvider.kt:53)
2021-01-04 17:40:05.231 7621-13750/? W/System.err:     at com.shabinder.spotiflyer.ui.tracklist.TrackListKt$TrackList$1.invokeSuspend(TrackList.kt:89)
2021-01-04 17:40:05.231 7621-13750/? W/System.err:     at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
2021-01-04 17:40:05.231 7621-13750/? W/System.err:     at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
2021-01-04 17:40:05.231 7621-13750/? W/System.err:     at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
2021-01-04 17:40:05.231 7621-13750/? W/System.err:     at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
2021-01-04 17:40:05.231 7621-13750/? W/System.err:     at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
2021-01-04 17:40:05.231 7621-13750/? W/System.err:     at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
sealedtx commented 3 years ago

@Shabinder This is another error, I will look

sealedtx commented 3 years ago

@Shabinder The problem was: extracting number of views from text "No views". Both problems are fixed and just released in 2.4.6

Shabinder commented 3 years ago

@sealedtx Thanks for your contributions , will try new release later tonight

Shabinder commented 3 years ago

Yeah All working gr8. Closing this issue.