Skip to content
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

Update invidious instances #365

Merged
merged 2 commits into from
Jul 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,29 @@ public static boolean isHooktubeURL(URL url) {

public static boolean isInvidioURL(URL url) {
String host = url.getHost();
return host.equalsIgnoreCase("invidio.us") || host.equalsIgnoreCase("dev.invidio.us") || host.equalsIgnoreCase("www.invidio.us") || host.equalsIgnoreCase("invidious.snopyta.org") || host.equalsIgnoreCase("de.invidious.snopyta.org") || host.equalsIgnoreCase("fi.invidious.snopyta.org") || host.equalsIgnoreCase("vid.wxzm.sx") || host.equalsIgnoreCase("invidious.kabi.tk") || host.equalsIgnoreCase("invidiou.sh") || host.equalsIgnoreCase("www.invidiou.sh") || host.equalsIgnoreCase("no.invidiou.sh") || host.equalsIgnoreCase("invidious.enkirton.net") || host.equalsIgnoreCase("tube.poal.co") || host.equalsIgnoreCase("invidious.13ad.de") || host.equalsIgnoreCase("yt.elukerio.org");
return host.equalsIgnoreCase("invidio.us")
|| host.equalsIgnoreCase("dev.invidio.us")
|| host.equalsIgnoreCase("www.invidio.us")
|| host.equalsIgnoreCase("invidious.snopyta.org")
|| host.equalsIgnoreCase("fi.invidious.snopyta.org")
|| host.equalsIgnoreCase("yewtu.be")
|| host.equalsIgnoreCase("invidious.ggc-project.de")
|| host.equalsIgnoreCase("yt.maisputain.ovh")
|| host.equalsIgnoreCase("invidious.13ad.de")
|| host.equalsIgnoreCase("invidious.toot.koeln")
|| host.equalsIgnoreCase("invidious.fdn.fr")
|| host.equalsIgnoreCase("watch.nettohikari.com")
|| host.equalsIgnoreCase("invidious.snwmds.net")
|| host.equalsIgnoreCase("invidious.snwmds.org")
|| host.equalsIgnoreCase("invidious.snwmds.com")
|| host.equalsIgnoreCase("invidious.sunsetravens.com")
|| host.equalsIgnoreCase("invidious.gachirangers.com");
}

/**
* Parses the duration string of the video expecting ":" or "." as seperators
* Parses the duration string of the video expecting ":" or "." as separators
* @return the duration in seconds
* @throws ParsingException when more than 3 seperators are found
* @throws ParsingException when more than 3 separators are found
*/
public static int parseDurationString(final String input)
throws ParsingException, NumberFormatException {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
package org.schabi.newpipe.extractor.services.youtube.linkHandler;

import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.BASE_YOUTUBE_INTENT_URL;

import org.schabi.newpipe.extractor.exceptions.FoundAdException;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.linkhandler.LinkHandler;
import org.schabi.newpipe.extractor.linkhandler.LinkHandlerFactory;
import org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper;
import org.schabi.newpipe.extractor.utils.Utils;

import javax.annotation.Nullable;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;

import javax.annotation.Nullable;
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.BASE_YOUTUBE_INTENT_URL;

/*
* Created by Christian Schabesberger on 02.02.16.
Expand Down Expand Up @@ -61,7 +60,7 @@ private static String assertIsId(@Nullable String id) throws ParsingException {

@Override
public LinkHandler fromUrl(String url) throws ParsingException {
if (url.startsWith(BASE_YOUTUBE_INTENT_URL)){
if (url.startsWith(BASE_YOUTUBE_INTENT_URL)) {
return super.fromUrl(url, BASE_YOUTUBE_INTENT_URL);
} else {
return super.fromUrl(url);
Expand Down Expand Up @@ -191,17 +190,19 @@ public String getId(String urlString) throws ParsingException, IllegalArgumentEx
case "DEV.INVIDIO.US":
case "INVIDIO.US":
case "INVIDIOUS.SNOPYTA.ORG":
case "DE.INVIDIOUS.SNOPYTA.ORG":
case "FI.INVIDIOUS.SNOPYTA.ORG":
case "VID.WXZM.SX":
case "INVIDIOUS.KABI.TK":
case "INVIDIOU.SH":
case "WWW.INVIDIOU.SH":
case "NO.INVIDIOU.SH":
case "INVIDIOUS.ENKIRTON.NET":
case "TUBE.POAL.CO":
case "YEWTU.BE":
case "INVIDIOUS.GGC-PROJECT.DE":
case "YT.MAISPUTAIN.OVH":
case "INVIDIOUS.13AD.DE":
case "YT.ELUKERIO.ORG": { // code-block for hooktube.com and Invidious instances
case "INVIDIOUS.TOOT.KOELN":
case "INVIDIOUS.FDN.FR":
case "WATCH.NETTOHIKARI.COM":
case "INVIDIOUS.SNWMDS.NET":
case "INVIDIOUS.SNWMDS.ORG":
case "INVIDIOUS.SNWMDS.COM":
case "INVIDIOUS.SUNSETRAVENS.COM":
case "INVIDIOUS.GACHIRANGERS.COM": { // code-block for hooktube.com and Invidious instances
if (path.equals("watch")) {
String viewQueryValue = Utils.getQueryValue(url, "v");
if (viewQueryValue != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,8 @@ public class YoutubeCommentsExtractorTest {

private static final String urlYT = "https://www.youtube.com/watch?v=D00Au7k3i6o";
private static final String urlInvidious = "https://invidio.us/watch?v=D00Au7k3i6o";
private static final String urlInvidioush = "https://invidiou.sh/watch?v=D00Au7k3i6o";
private static YoutubeCommentsExtractor extractorYT;
private static YoutubeCommentsExtractor extractorInvidious;
private static YoutubeCommentsExtractor extractorInvidioush;

@BeforeClass
public static void setUp() throws Exception {
Expand All @@ -37,15 +35,12 @@ public static void setUp() throws Exception {
.getCommentsExtractor(urlYT);
extractorInvidious = (YoutubeCommentsExtractor) YouTube
.getCommentsExtractor(urlInvidious);
extractorInvidioush = (YoutubeCommentsExtractor) YouTube
.getCommentsExtractor(urlInvidioush);
}

@Test
public void testGetComments() throws IOException, ExtractionException {
assertTrue(getCommentsHelper(extractorYT));
assertTrue(getCommentsHelper(extractorInvidious));
assertTrue(getCommentsHelper(extractorInvidioush));
}

private boolean getCommentsHelper(YoutubeCommentsExtractor extractor) throws IOException, ExtractionException {
Expand All @@ -65,7 +60,6 @@ private boolean getCommentsHelper(YoutubeCommentsExtractor extractor) throws IOE
public void testGetCommentsFromCommentsInfo() throws IOException, ExtractionException {
assertTrue(getCommentsFromCommentsInfoHelper(urlYT));
assertTrue(getCommentsFromCommentsInfoHelper(urlInvidious));
assertTrue(getCommentsFromCommentsInfoHelper(urlInvidioush));
}

private boolean getCommentsFromCommentsInfoHelper(String url) throws IOException, ExtractionException {
Expand Down