-
Notifications
You must be signed in to change notification settings - Fork 425
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
Add AccountTerminatedException for terminated channels #580
Changes from all commits
bb3861d
fc99858
f4404b5
ec50570
fa444c8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package org.schabi.newpipe.extractor.exceptions; | ||
|
||
public class AccountTerminatedException extends ContentNotAvailableException { | ||
|
||
private Reason reason = Reason.UNKNOWN; | ||
|
||
public AccountTerminatedException(final String message) { | ||
super(message); | ||
} | ||
|
||
public AccountTerminatedException(final String message, final Reason reason) { | ||
super(message); | ||
this.reason = reason; | ||
} | ||
|
||
public AccountTerminatedException(final String message, final Throwable cause) { | ||
super(message, cause); | ||
} | ||
|
||
/** | ||
* The reason for the violation. There should also be more info in the exception's message. | ||
*/ | ||
public Reason getReason() { | ||
return reason; | ||
} | ||
|
||
public enum Reason { | ||
UNKNOWN, | ||
VIOLATION | ||
} | ||
} |
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
{ | ||
"request": { | ||
"httpMethod": "GET", | ||
"url": "https://www.youtube.com/channel/DOESNT-EXIST/videos?pbj\u003d1\u0026view\u003d0\u0026flow\u003dgrid", | ||
"headers": { | ||
"Accept-Language": [ | ||
"en-GB, en;q\u003d0.9" | ||
], | ||
"Cookie": [ | ||
"CONSENT\u003dPENDING+100406" | ||
], | ||
"X-YouTube-Client-Name": [ | ||
"1" | ||
], | ||
"X-YouTube-Client-Version": [ | ||
"2.20200214.04.00" | ||
] | ||
}, | ||
"localization": { | ||
"languageCode": "en", | ||
"countryCode": "GB" | ||
} | ||
}, | ||
"response": { | ||
"responseCode": 404, | ||
"responseMessage": "", | ||
"responseHeaders": { | ||
"alt-svc": [ | ||
"h3-29\u003d\":443\"; ma\u003d2592000,h3-T051\u003d\":443\"; ma\u003d2592000,h3-Q050\u003d\":443\"; ma\u003d2592000,h3-Q046\u003d\":443\"; ma\u003d2592000,h3-Q043\u003d\":443\"; ma\u003d2592000,quic\u003d\":443\"; ma\u003d2592000; v\u003d\"46,43\"" | ||
], | ||
"cache-control": [ | ||
"no-cache, no-store, max-age\u003d0, must-revalidate" | ||
], | ||
"content-type": [ | ||
"text/html; charset\u003dutf-8" | ||
], | ||
"date": [ | ||
"Sat, 01 May 2021 15:47:25 GMT" | ||
], | ||
"expires": [ | ||
"Mon, 01 Jan 1990 00:00:00 GMT" | ||
], | ||
"p3p": [ | ||
"CP\u003d\"This is not a P3P policy! See http://support.google.com/accounts/answer/151657?hl\u003den-GB for more info.\"" | ||
], | ||
"permissions-policy": [ | ||
"ch-ua-full-version\u003d*, ch-ua-platform\u003d*, ch-ua-platform-version\u003d*, ch-ua-arch\u003d*, ch-ua-model\u003d*" | ||
], | ||
"pragma": [ | ||
"no-cache" | ||
], | ||
"server": [ | ||
"ESF" | ||
], | ||
"set-cookie": [ | ||
"YSC\u003dgPx3EMoLzV4; Domain\u003d.youtube.com; Path\u003d/; Secure; HttpOnly; SameSite\u003dnone" | ||
], | ||
"strict-transport-security": [ | ||
"max-age\u003d31536000" | ||
], | ||
"x-content-type-options": [ | ||
"nosniff" | ||
], | ||
"x-frame-options": [ | ||
"SAMEORIGIN" | ||
], | ||
"x-xss-protection": [ | ||
"0" | ||
] | ||
}, | ||
"responseBody": "\u003chtml lang\u003d\"en-GB\" dir\u003d\"ltr\"\u003e\u003chead\u003e\u003ctitle\u003e404 Not Found\u003c/title\u003e\u003cstyle nonce\u003d\"J6HBrtOLDsO+k15HZ0o11w\"\u003e*{margin:0;padding:0;border:0}html,body{height:100%;}\u003c/style\u003e\u003clink rel\u003d\"shortcut icon\" href\u003d\"https://www.youtube.com/img/favicon.ico\" type\u003d\"image/x-icon\"\u003e\u003clink rel\u003d\"icon\" href\u003d\"https://www.youtube.com/img/favicon_32.png\" sizes\u003d\"32x32\"\u003e\u003clink rel\u003d\"icon\" href\u003d\"https://www.youtube.com/img/favicon_48.png\" sizes\u003d\"48x48\"\u003e\u003clink rel\u003d\"icon\" href\u003d\"https://www.youtube.com/img/favicon_96.png\" sizes\u003d\"96x96\"\u003e\u003clink rel\u003d\"icon\" href\u003d\"https://www.youtube.com/img/favicon_144.png\" sizes\u003d\"144x144\"\u003e\u003c/head\u003e\u003cbody\u003e\u003ciframe style\u003d\"display:block;border:0;\" src\u003d\"/error?src\u003d404\u0026amp;ifr\u003d1\u0026amp;error\u003d\" width\u003d\"100%\" height\u003d\"100%\" frameborder\u003d\"\\\" scrolling\u003d\"no\"\u003e\u003c/iframe\u003e\u003c/body\u003e\u003c/html\u003e", | ||
"latestUrl": "https://www.youtube.com/channel/DOESNT-EXIST/videos?pbj\u003d1\u0026view\u003d0\u0026flow\u003dgrid" | ||
} | ||
} |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"request": { | ||
"httpMethod": "GET", | ||
"url": "https://www.youtube.com/feeds/videos.xml?channel_id\u003dUCTGjY2I-ZUGnwVoWAGRd7XQ", | ||
"headers": { | ||
"Accept-Language": [ | ||
"en-GB, en;q\u003d0.9" | ||
] | ||
}, | ||
"localization": { | ||
"languageCode": "en", | ||
"countryCode": "GB" | ||
} | ||
}, | ||
"response": { | ||
"responseCode": 404, | ||
"responseMessage": "", | ||
"responseHeaders": { | ||
"alt-svc": [ | ||
"h3-29\u003d\":443\"; ma\u003d2592000,h3-T051\u003d\":443\"; ma\u003d2592000,h3-Q050\u003d\":443\"; ma\u003d2592000,h3-Q046\u003d\":443\"; ma\u003d2592000,h3-Q043\u003d\":443\"; ma\u003d2592000,quic\u003d\":443\"; ma\u003d2592000; v\u003d\"46,43\"" | ||
], | ||
"content-length": [ | ||
"1613" | ||
], | ||
"content-type": [ | ||
"text/html; charset\u003dUTF-8" | ||
], | ||
"date": [ | ||
"Tue, 30 Mar 2021 08:33:07 GMT" | ||
], | ||
"server": [ | ||
"YouTube RSS Feeds server" | ||
], | ||
"x-frame-options": [ | ||
"SAMEORIGIN" | ||
], | ||
"x-xss-protection": [ | ||
"0" | ||
] | ||
}, | ||
"responseBody": "\u003c!DOCTYPE html\u003e\n\u003chtml lang\u003den\u003e\n \u003cmeta charset\u003dutf-8\u003e\n \u003cmeta name\u003dviewport content\u003d\"initial-scale\u003d1, minimum-scale\u003d1, width\u003ddevice-width\"\u003e\n \u003ctitle\u003eError 404 (Not Found)!!1\u003c/title\u003e\n \u003cstyle\u003e\n *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* \u003e body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}\n \u003c/style\u003e\n \u003ca href\u003d//www.google.com/\u003e\u003cspan id\u003dlogo aria-label\u003dGoogle\u003e\u003c/span\u003e\u003c/a\u003e\n \u003cp\u003e\u003cb\u003e404.\u003c/b\u003e \u003cins\u003eThat’s an error.\u003c/ins\u003e\n \u003cp\u003eThe requested URL \u003ccode\u003e/feeds/videos.xml?channel_id\u003dUCTGjY2I-ZUGnwVoWAGRd7XQ\u003c/code\u003e was not found on this server. \u003cins\u003eThat’s all we know.\u003c/ins\u003e\n", | ||
"latestUrl": "https://www.youtube.com/feeds/videos.xml?channel_id\u003dUCTGjY2I-ZUGnwVoWAGRd7XQ" | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what happens if the localization is changed to non-english. I would assume the error messages are localized
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@XiangRongLin Yes, they are, it's the same thing for the error messages from YouTube videos.
I think in the future we need to implement something which stores strings of the error messages for each localization and compare with the value provided by YouTube in the language used for the extraction of YouTube datas.