Merge pull request #1160 from TeamNewPipe/fix/tests
Fix some failing unit tests and detect new account termination messages for YouTube
This commit is contained in:
commit
adcc1f17ee
|
@ -1620,8 +1620,10 @@ public final class YoutubeParsingHelper {
|
|||
final String alertText = getTextFromObject(alertRenderer.getObject("text"));
|
||||
final String alertType = alertRenderer.getString("type", "");
|
||||
if (alertType.equalsIgnoreCase("ERROR")) {
|
||||
if (alertText != null && alertText.contains("This account has been terminated")) {
|
||||
if (alertText.contains("violation") || alertText.contains("violating")
|
||||
if (alertText != null
|
||||
&& (alertText.contains("This account has been terminated")
|
||||
|| alertText.contains("This channel was removed"))) {
|
||||
if (alertText.matches(".*violat(ed|ion|ing).*")
|
||||
|| alertText.contains("infringement")) {
|
||||
// Possible error messages:
|
||||
// "This account has been terminated for a violation of YouTube's Terms of
|
||||
|
@ -1643,6 +1645,7 @@ public final class YoutubeParsingHelper {
|
|||
// the user posted."
|
||||
// "This account has been terminated because it is linked to an account that
|
||||
// received multiple third-party claims of copyright infringement."
|
||||
// "This channel was removed because it violated our Community Guidelines."
|
||||
throw new AccountTerminatedException(alertText,
|
||||
AccountTerminatedException.Reason.VIOLATION);
|
||||
} else {
|
||||
|
|
|
@ -48,7 +48,7 @@ public class PeertubeCommentsExtractorTest {
|
|||
|
||||
@Test
|
||||
void testGetCommentsFromCommentsInfo() throws IOException, ExtractionException {
|
||||
final String comment = "Thanks for creating such an informative video";
|
||||
final String comment = "Thanks for this nice video explanation of Peertube!";
|
||||
|
||||
final CommentsInfo commentsInfo =
|
||||
CommentsInfo.getInfo("https://framatube.org/w/kkGMgK9ZtnKfYAgnEtQxbv");
|
||||
|
|
|
@ -86,7 +86,7 @@ public abstract class PeertubeStreamExtractorTest extends DefaultStreamExtractor
|
|||
@Override public long expectedViewCountAtLeast() { return 38600; }
|
||||
@Nullable @Override public String expectedUploadDate() { return "2018-10-01 10:52:46.396"; }
|
||||
@Nullable @Override public String expectedTextualUploadDate() { return "2018-10-01T10:52:46.396Z"; }
|
||||
@Override public long expectedLikeCountAtLeast() { return 50; }
|
||||
@Override public long expectedLikeCountAtLeast() { return 20; }
|
||||
@Override public long expectedDislikeCountAtLeast() { return 0; }
|
||||
@Override public String expectedHost() { return "framatube.org"; }
|
||||
@Override public String expectedCategory() { return "Science & Technology"; }
|
||||
|
|
|
@ -186,7 +186,7 @@ public class SoundcloudSearchExtractorTest {
|
|||
public static class NoNextPage extends DefaultSearchExtractorTest {
|
||||
|
||||
private static SearchExtractor extractor;
|
||||
private static final String QUERY = "Dan at hor#berlgbd";
|
||||
private static final String QUERY = "wpghüä";
|
||||
|
||||
@BeforeAll
|
||||
public static void setUp() throws Exception {
|
||||
|
|
|
@ -41,10 +41,10 @@
|
|||
"same-origin; report-to\u003d\"youtube_main\""
|
||||
],
|
||||
"date": [
|
||||
"Fri, 08 Dec 2023 19:37:57 GMT"
|
||||
"Wed, 20 Mar 2024 13:58:42 GMT"
|
||||
],
|
||||
"expires": [
|
||||
"Fri, 08 Dec 2023 19:37:57 GMT"
|
||||
"Wed, 20 Mar 2024 13:58:42 GMT"
|
||||
],
|
||||
"origin-trial": [
|
||||
"AvC9UlR6RDk2crliDsFl66RWLnTbHrDbp+DiY6AYz/PNQ4G4tdUTjrHYr2sghbkhGQAVxb7jaPTHpEVBz0uzQwkAAAB4eyJvcmlnaW4iOiJodHRwczovL3lvdXR1YmUuY29tOjQ0MyIsImZlYXR1cmUiOiJXZWJWaWV3WFJlcXVlc3RlZFdpdGhEZXByZWNhdGlvbiIsImV4cGlyeSI6MTcxOTUzMjc5OSwiaXNTdWJkb21haW4iOnRydWV9"
|
||||
|
@ -62,9 +62,8 @@
|
|||
"ESF"
|
||||
],
|
||||
"set-cookie": [
|
||||
"YSC\u003d45cg5Fq7qO4; Domain\u003d.youtube.com; Path\u003d/; Secure; HttpOnly; SameSite\u003dnone",
|
||||
"VISITOR_INFO1_LIVE\u003d; Domain\u003d.youtube.com; Expires\u003dSat, 13-Mar-2021 19:37:57 GMT; Path\u003d/; Secure; HttpOnly; SameSite\u003dnone",
|
||||
"CONSENT\u003dPENDING+095; expires\u003dSun, 07-Dec-2025 19:37:57 GMT; path\u003d/; domain\u003d.youtube.com; Secure"
|
||||
"YSC\u003dLzBi9veM9G4; Domain\u003d.youtube.com; Path\u003d/; Secure; HttpOnly; SameSite\u003dnone",
|
||||
"VISITOR_INFO1_LIVE\u003d; Domain\u003d.youtube.com; Expires\u003dThu, 24-Jun-2021 13:58:42 GMT; Path\u003d/; Secure; HttpOnly; SameSite\u003dnone"
|
||||
],
|
||||
"strict-transport-security": [
|
||||
"max-age\u003d31536000"
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -13,7 +13,7 @@
|
|||
"SOCS\u003dCAE\u003d"
|
||||
],
|
||||
"X-YouTube-Client-Version": [
|
||||
"2.20231208.01.00"
|
||||
"2.20240313.05.00"
|
||||
],
|
||||
"X-YouTube-Client-Name": [
|
||||
"1"
|
||||
|
@ -254,14 +254,14 @@
|
|||
50,
|
||||
48,
|
||||
50,
|
||||
52,
|
||||
48,
|
||||
51,
|
||||
49,
|
||||
50,
|
||||
48,
|
||||
56,
|
||||
51,
|
||||
46,
|
||||
48,
|
||||
49,
|
||||
53,
|
||||
46,
|
||||
48,
|
||||
48,
|
||||
|
@ -376,7 +376,7 @@
|
|||
"application/json; charset\u003dUTF-8"
|
||||
],
|
||||
"date": [
|
||||
"Fri, 08 Dec 2023 19:37:58 GMT"
|
||||
"Wed, 20 Mar 2024 13:58:43 GMT"
|
||||
],
|
||||
"server": [
|
||||
"scaffolding on HTTPServer2"
|
||||
|
|
Loading…
Reference in New Issue