mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-25 01:20:34 +00:00
fixed related view 0 view count error
This commit is contained in:
parent
3441aceba3
commit
d0bab6183a
@ -127,9 +127,10 @@ public class VideoItemDetailFragment extends Fragment {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
VideoInfo videoInfo = null;
|
||||||
try {
|
try {
|
||||||
streamExtractor = service.getExtractorInstance(videoUrl, new Downloader());
|
streamExtractor = service.getExtractorInstance(videoUrl, new Downloader());
|
||||||
VideoInfo videoInfo = VideoInfo.getVideoInfo(streamExtractor, new Downloader());
|
videoInfo = VideoInfo.getVideoInfo(streamExtractor, new Downloader());
|
||||||
|
|
||||||
h.post(new VideoResultReturnedRunnable(videoInfo));
|
h.post(new VideoResultReturnedRunnable(videoInfo));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -170,6 +171,14 @@ public class VideoItemDetailFragment extends Fragment {
|
|||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
postNewErrorToast(h, R.string.general_error);
|
postNewErrorToast(h, R.string.general_error);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
if(videoInfo != null &&
|
||||||
|
!videoInfo.errors.isEmpty()) {
|
||||||
|
Log.e(TAG, "OCCURRED ERRORS DURING EXTRACTION:");
|
||||||
|
for(Exception e : videoInfo.errors) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -699,7 +699,7 @@ public class YoutubeStreamExtractor implements StreamExtractor {
|
|||||||
try {
|
try {
|
||||||
info.view_count = Long.parseLong(li.select("span.view-count")
|
info.view_count = Long.parseLong(li.select("span.view-count")
|
||||||
.first().text().replaceAll("[^\\d]", ""));
|
.first().text().replaceAll("[^\\d]", ""));
|
||||||
} catch (NullPointerException e) {//related videos sometimes have no view count
|
} catch (Exception e) {//related videos sometimes have no view count
|
||||||
info.view_count = 0;
|
info.view_count = 0;
|
||||||
}
|
}
|
||||||
info.uploader = li.select("span.g-hovercard").first().text();
|
info.uploader = li.select("span.g-hovercard").first().text();
|
||||||
|
Loading…
Reference in New Issue
Block a user