mirror of
https://github.com/TeamNewPipe/NewPipeExtractor.git
synced 2024-12-14 06:10:33 +05:30
Merge pull request #741 from mhmdanas/add-y2ube-link-support
Add support for y2u.be links
This commit is contained in:
commit
4f60225ddc
@ -162,6 +162,10 @@ public class YoutubeParsingHelper {
|
||||
|| host.equalsIgnoreCase("y.com.cm");
|
||||
}
|
||||
|
||||
public static boolean isY2ubeURL(@Nonnull final URL url) {
|
||||
return url.getHost().equalsIgnoreCase("y2u.be");
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the duration string of the video expecting ":" or "." as separators
|
||||
*
|
||||
|
@ -110,7 +110,7 @@ public class YoutubeStreamLinkHandlerFactory extends LinkHandlerFactory {
|
||||
|
||||
if (!Utils.isHTTP(url) || !(YoutubeParsingHelper.isYoutubeURL(url) ||
|
||||
YoutubeParsingHelper.isYoutubeServiceURL(url) || YoutubeParsingHelper.isHooktubeURL(url) ||
|
||||
YoutubeParsingHelper.isInvidioURL(url))) {
|
||||
YoutubeParsingHelper.isInvidioURL(url) || YoutubeParsingHelper.isY2ubeURL(url))) {
|
||||
if (host.equalsIgnoreCase("googleads.g.doubleclick.net")) {
|
||||
throw new FoundAdException("Error found ad: " + urlString);
|
||||
}
|
||||
@ -160,6 +160,7 @@ public class YoutubeStreamLinkHandlerFactory extends LinkHandlerFactory {
|
||||
return assertIsId(viewQueryValue);
|
||||
}
|
||||
|
||||
case "Y2U.BE":
|
||||
case "YOUTU.BE": {
|
||||
String viewQueryValue = Utils.getQueryValue(url, "v");
|
||||
if (viewQueryValue != null) {
|
||||
|
@ -61,4 +61,10 @@ public class YoutubeCommentsLinkHandlerFactoryTest {
|
||||
assertEquals("VM_6n762j6M", linkHandler.fromUrl("https://invidio.us/VM_6n762j6M&t=20").getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getIdFromY2ube() throws ParsingException {
|
||||
assertEquals("VM_6n762j6M", linkHandler.fromUrl("https://y2u.be/VM_6n762j6M").getId());
|
||||
assertEquals("VM_6n762j6M", linkHandler.fromUrl("https://Y2U.Be/VM_6n762j6M").getId());
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user