Use UNKNOWN_REPLY_COUNT everywhere
This commit is contained in:
parent
659d6aef4a
commit
4b4c7e869a
|
@ -1,5 +1,6 @@
|
||||||
package org.schabi.newpipe.extractor.services.youtube.extractors;
|
package org.schabi.newpipe.extractor.services.youtube.extractors;
|
||||||
|
|
||||||
|
import static org.schabi.newpipe.extractor.comments.CommentsInfoItem.UNKNOWN_REPLY_COUNT;
|
||||||
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getTextFromObject;
|
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getTextFromObject;
|
||||||
|
|
||||||
import com.grack.nanojson.JsonArray;
|
import com.grack.nanojson.JsonArray;
|
||||||
|
@ -253,7 +254,7 @@ public class YoutubeCommentsInfoItemExtractor implements CommentsInfoItemExtract
|
||||||
try {
|
try {
|
||||||
return JsonUtils.getNumber(json, "comment.commentRenderer.replyCount").intValue();
|
return JsonUtils.getNumber(json, "comment.commentRenderer.replyCount").intValue();
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
return -1;
|
return UNKNOWN_REPLY_COUNT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,9 @@ import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertGreater;
|
||||||
import static org.schabi.newpipe.extractor.ServiceList.YouTube;
|
import static org.schabi.newpipe.extractor.ServiceList.YouTube;
|
||||||
|
import static org.schabi.newpipe.extractor.comments.CommentsInfoItem.UNKNOWN_REPLY_COUNT;
|
||||||
|
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
@ -338,9 +340,8 @@ public class YoutubeCommentsExtractorTest {
|
||||||
|
|
||||||
CommentsInfoItem firstComment = comments.getItems().get(0);
|
CommentsInfoItem firstComment = comments.getItems().get(0);
|
||||||
|
|
||||||
assertNotEquals(-1, firstComment.getReplyCount(), "First reply comment can't get count");
|
assertNotEquals(UNKNOWN_REPLY_COUNT, firstComment.getReplyCount(), "First reply comment can't get count");
|
||||||
assertGreater(300, firstComment.getReplyCount(), "First reply comment count is smaller than the expected 300 comments");
|
assertGreater(300, firstComment.getReplyCount(), "First reply comment count is smaller than the expected 300 comments");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue