Merge pull request #741 from mhmdanas/add-y2ube-link-support
Add support for y2u.be links
This commit is contained in:
commit
4f60225ddc
3 changed files with 12 additions and 1 deletions
|
@ -162,6 +162,10 @@ public class YoutubeParsingHelper {
|
||||||
|| host.equalsIgnoreCase("y.com.cm");
|
|| 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
|
* 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) ||
|
if (!Utils.isHTTP(url) || !(YoutubeParsingHelper.isYoutubeURL(url) ||
|
||||||
YoutubeParsingHelper.isYoutubeServiceURL(url) || YoutubeParsingHelper.isHooktubeURL(url) ||
|
YoutubeParsingHelper.isYoutubeServiceURL(url) || YoutubeParsingHelper.isHooktubeURL(url) ||
|
||||||
YoutubeParsingHelper.isInvidioURL(url))) {
|
YoutubeParsingHelper.isInvidioURL(url) || YoutubeParsingHelper.isY2ubeURL(url))) {
|
||||||
if (host.equalsIgnoreCase("googleads.g.doubleclick.net")) {
|
if (host.equalsIgnoreCase("googleads.g.doubleclick.net")) {
|
||||||
throw new FoundAdException("Error found ad: " + urlString);
|
throw new FoundAdException("Error found ad: " + urlString);
|
||||||
}
|
}
|
||||||
|
@ -160,6 +160,7 @@ public class YoutubeStreamLinkHandlerFactory extends LinkHandlerFactory {
|
||||||
return assertIsId(viewQueryValue);
|
return assertIsId(viewQueryValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case "Y2U.BE":
|
||||||
case "YOUTU.BE": {
|
case "YOUTU.BE": {
|
||||||
String viewQueryValue = Utils.getQueryValue(url, "v");
|
String viewQueryValue = Utils.getQueryValue(url, "v");
|
||||||
if (viewQueryValue != null) {
|
if (viewQueryValue != null) {
|
||||||
|
|
|
@ -61,4 +61,10 @@ public class YoutubeCommentsLinkHandlerFactoryTest {
|
||||||
assertEquals("VM_6n762j6M", linkHandler.fromUrl("https://invidio.us/VM_6n762j6M&t=20").getId());
|
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 a new issue