mirror of
				https://github.com/TeamNewPipe/NewPipe
				synced 2025-11-04 01:03:00 +00:00 
			
		
		
		
	fixed related view 0 view count error
This commit is contained in:
		@@ -127,9 +127,10 @@ public class VideoItemDetailFragment extends Fragment {
 | 
			
		||||
 | 
			
		||||
        @Override
 | 
			
		||||
        public void run() {
 | 
			
		||||
            VideoInfo videoInfo = null;
 | 
			
		||||
            try {
 | 
			
		||||
                streamExtractor = service.getExtractorInstance(videoUrl, new Downloader());
 | 
			
		||||
                VideoInfo videoInfo = VideoInfo.getVideoInfo(streamExtractor, new Downloader());
 | 
			
		||||
                videoInfo = VideoInfo.getVideoInfo(streamExtractor, new Downloader());
 | 
			
		||||
 | 
			
		||||
                h.post(new VideoResultReturnedRunnable(videoInfo));
 | 
			
		||||
            } catch (IOException e) {
 | 
			
		||||
@@ -170,6 +171,14 @@ public class VideoItemDetailFragment extends Fragment {
 | 
			
		||||
            } catch(Exception e) {
 | 
			
		||||
                postNewErrorToast(h, R.string.general_error);
 | 
			
		||||
                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 {
 | 
			
		||||
                info.view_count = Long.parseLong(li.select("span.view-count")
 | 
			
		||||
                        .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.uploader = li.select("span.g-hovercard").first().text();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user