Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not parse "No Likes" in 0.21.14 #7525

Closed
4 tasks done
theScrabi opened this issue Dec 11, 2021 · 4 comments · Fixed by #7589
Closed
4 tasks done

Could not parse "No Likes" in 0.21.14 #7525

theScrabi opened this issue Dec 11, 2021 · 4 comments · Fixed by #7589
Labels
bug Issue is related to a bug requires extractor change This issue requires a change to the extractor youtube Service, https://www.youtube.com/

Comments

@theScrabi
Copy link
Member

Checklist

Steps to reproduce the bug

  1. Go to ''https://www.youtube.com/watch?v=OmKHzhv1x1M" in newpipe

Actual behavior

Error snackbar is triggered

Expected behavior

No error should be triggered

Log

Exception

Crash log

org.schabi.newpipe.extractor.exceptions.ParsingException: Could not parse "No likes" as an Integer
	at org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeStreamExtractor.getLikeCount(YoutubeStreamExtractor.java:369)
	at org.schabi.newpipe.extractor.stream.StreamInfo.extractOptionalData(StreamInfo.java:281)
	at org.schabi.newpipe.extractor.stream.StreamInfo.getInfo(StreamInfo.java:73)
	at org.schabi.newpipe.extractor.stream.StreamInfo.getInfo(StreamInfo.java:64)
	at org.schabi.newpipe.util.ExtractorHelper.lambda$getStreamInfo$3(ExtractorHelper.java:116)
	at org.schabi.newpipe.util.ExtractorHelper.$r8$lambda$YTHJjScxCJNO1LTCqs3IKy35iyY(Unknown Source:0)
	at org.schabi.newpipe.util.ExtractorHelper$$ExternalSyntheticLambda6.call(Unknown Source:4)
	at io.reactivex.rxjava3.internal.operators.single.SingleFromCallable.subscribeActual(SingleFromCallable.java:43)
	at io.reactivex.rxjava3.core.Single.subscribe(Single.java:4813)
	at io.reactivex.rxjava3.internal.operators.single.SingleDoOnSuccess.subscribeActual(SingleDoOnSuccess.java:35)
	at io.reactivex.rxjava3.core.Single.subscribe(Single.java:4813)
	at io.reactivex.rxjava3.internal.operators.maybe.MaybeFromSingle.subscribeActual(MaybeFromSingle.java:41)
	at io.reactivex.rxjava3.core.Maybe.subscribe(Maybe.java:5330)
	at io.reactivex.rxjava3.internal.operators.maybe.MaybeConcatArray$ConcatMaybeObserver.drain(MaybeConcatArray.java:153)
	at io.reactivex.rxjava3.internal.operators.maybe.MaybeConcatArray$ConcatMaybeObserver.request(MaybeConcatArray.java:78)
	at io.reactivex.rxjava3.internal.operators.flowable.FlowableElementAtMaybe$ElementAtSubscriber.onSubscribe(FlowableElementAtMaybe.java:66)
	at io.reactivex.rxjava3.internal.operators.maybe.MaybeConcatArray.subscribeActual(MaybeConcatArray.java:42)
	at io.reactivex.rxjava3.core.Flowable.subscribe(Flowable.java:15753)
	at io.reactivex.rxjava3.internal.operators.flowable.FlowableElementAtMaybe.subscribeActual(FlowableElementAtMaybe.java:36)
	at io.reactivex.rxjava3.core.Maybe.subscribe(Maybe.java:5330)
	at io.reactivex.rxjava3.internal.operators.maybe.MaybeToSingle.subscribeActual(MaybeToSingle.java:46)
	at io.reactivex.rxjava3.core.Single.subscribe(Single.java:4813)
	at io.reactivex.rxjava3.internal.operators.single.SingleSubscribeOn$SubscribeOnObserver.run(SingleSubscribeOn.java:89)
	at io.reactivex.rxjava3.core.Scheduler$DisposeTask.run(Scheduler.java:614)
	at io.reactivex.rxjava3.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:65)
	at io.reactivex.rxjava3.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:56)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
	at java.lang.Thread.run(Thread.java:923)
Caused by: java.lang.NumberFormatException: For input string: ""
	at java.lang.Integer.parseInt(Integer.java:627)
	at java.lang.Integer.parseInt(Integer.java:650)
	at org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeStreamExtractor.getLikeCount(YoutubeStreamExtractor.java:367)
	... 30 more


@theScrabi theScrabi added the bug Issue is related to a bug label Dec 11, 2021
@TobiGr TobiGr added the youtube Service, https://www.youtube.com/ label Dec 11, 2021
@litetex
Copy link
Member

litetex commented Dec 12, 2021

Problem analysis: The video has 0 likes -> YT returns "No likes" -> We can't parse that.

@XiangRongLin XiangRongLin added good first issue Easy/simple issues perfect for newcomers to get involved in the project requires extractor change This issue requires a change to the extractor labels Dec 15, 2021
@AudricV
Copy link
Member

AudricV commented Dec 15, 2021

There are also two accessibility data which contain 0 for the number of views when they are no likes: here is the JSON part of the like button renderer for this video (tracking fields values and modalEnpoint object have been removed):

"toggleButtonRenderer": {
  "style": {
    "styleType": "STYLE_TEXT"
  },
  "isToggled": false,
  "isDisabled": false,
  "defaultIcon": {
    "iconType": "LIKE"
  },
  "defaultText": {
    "accessibility": {
      "accessibilityData": {
        "label": "No likes"
      }
    },
    "simpleText": "0"
  },
  "toggledText": {
    "accessibility": {
      "accessibilityData": {
        "label": "1 like"
      }
    },
    "simpleText": "1"
  },
  "accessibility": {
    "label": "like this video along with 0 other people"
  },
  "trackingParams": "",
  "defaultTooltip": "I like this",
  "toggledTooltip": "Unlike",
  "toggledStyle": {
    "styleType": "STYLE_DEFAULT_ACTIVE"
  },
  "defaultNavigationEndpoint": {
    "clickTrackingParams": "",
    "commandMetadata": {
      "webCommandMetadata": {
        "ignoreNavigation": true
      }
    },
    "modalEndpoint": {}
  },
  "accessibilityData": {
    "accessibilityData": {
      "label": "like this video along with 0 other people"
    }
  },
  "toggleButtonSupportedData": {
    "toggleButtonIdData": {
      "id": "TOGGLE_BUTTON_ID_TYPE_LIKE"
    }
  },
  "targetId": "watch-like"
}

If this issue is fixed by using one of the accessibility data which returns the numeric value of no likes (0), the old way to get likes and the way to get dislikes should be removed (the sentimentBar JSON object has been removed) (and -1 needs to be now permanently returned for YouTube dislikes (they removed the averageRating value so we can no longer calculate a dislike count)).

@litetex litetex removed the good first issue Easy/simple issues perfect for newcomers to get involved in the project label Dec 27, 2021
@litetex litetex mentioned this issue Dec 27, 2021
5 tasks
@litetex
Copy link
Member

litetex commented Dec 27, 2021

Should be fixed with TeamNewPipe/NewPipeExtractor#755 :)
A test APK is available with #7589

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is related to a bug requires extractor change This issue requires a change to the extractor youtube Service, https://www.youtube.com/
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants