fix Invidious channels being accepted by YoutubeStreamLinkHandlerFactory (#527)

fixes https://github.com/TeamNewPipe/NewPipeExtractor/issues/524, see it for more details
This commit is contained in:
bopol 2021-02-05 18:57:58 +01:00 committed by GitHub
parent 1414a6f178
commit 44c54d403a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -36,7 +36,7 @@ import java.util.regex.Pattern;
public class YoutubeStreamLinkHandlerFactory extends LinkHandlerFactory { public class YoutubeStreamLinkHandlerFactory extends LinkHandlerFactory {
private static final Pattern YOUTUBE_VIDEO_ID_REGEX_PATTERN = Pattern.compile("([a-zA-Z0-9_-]{11})"); private static final Pattern YOUTUBE_VIDEO_ID_REGEX_PATTERN = Pattern.compile("^([a-zA-Z0-9_-]{11})");
private static final YoutubeStreamLinkHandlerFactory instance = new YoutubeStreamLinkHandlerFactory(); private static final YoutubeStreamLinkHandlerFactory instance = new YoutubeStreamLinkHandlerFactory();
private YoutubeStreamLinkHandlerFactory() { private YoutubeStreamLinkHandlerFactory() {

View File

@ -42,6 +42,8 @@ public class YoutubeStreamLinkHandlerFactoryTest {
invalidUrls.add("https://www.youtube.com/watch?v=jZViOEv90d"); invalidUrls.add("https://www.youtube.com/watch?v=jZViOEv90d");
invalidUrls.add("https://www.youtube.com/watchjZViOEv90d"); invalidUrls.add("https://www.youtube.com/watchjZViOEv90d");
invalidUrls.add("https://www.youtube.com/"); invalidUrls.add("https://www.youtube.com/");
invalidUrls.add("https://www.youtube.com/channel/UCBR8-60-B28hp2BmDPdntcQ");
invalidUrls.add("https://invidio.us/channel/UCBR8-60-B28hp2BmDPdntcQ");
for (String invalidUrl : invalidUrls) { for (String invalidUrl : invalidUrls) {
Throwable exception = null; Throwable exception = null;
try { try {