mirror of
https://github.com/TeamNewPipe/NewPipeExtractor.git
synced 2025-04-27 15:30:34 +05:30
fix channel links in description part 2
This commit is contained in:
parent
4469d11307
commit
66c3c3f452
@ -178,6 +178,7 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
|||||||
// They refer to the youtube search. We do not handle them.
|
// They refer to the youtube search. We do not handle them.
|
||||||
a.text(link);
|
a.text(link);
|
||||||
|
|
||||||
|
}
|
||||||
} else if(redirectLink.toString().contains("watch?v=")
|
} else if(redirectLink.toString().contains("watch?v=")
|
||||||
|| redirectLink.toString().contains("https://www.youtube.com/")) {
|
|| redirectLink.toString().contains("https://www.youtube.com/")) {
|
||||||
// Another posibility is that this link is pointing to another video
|
// Another posibility is that this link is pointing to another video
|
||||||
@ -185,7 +186,6 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
|||||||
a.text(redirectLink.toString());
|
a.text(redirectLink.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return description.select("body").first().html();
|
return description.select("body").first().html();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ import java.io.IOException;
|
|||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertIsSecureUrl;
|
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertIsSecureUrl;
|
||||||
import static org.schabi.newpipe.extractor.ServiceList.YouTube;
|
import static org.schabi.newpipe.extractor.ServiceList.YouTube;
|
||||||
|
import static org.schabi.newpipe.extractor.services.youtube.YoutubeTrendingExtractorTest.extractor;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Created by Christian Schabesberger on 30.12.15.
|
* Created by Christian Schabesberger on 30.12.15.
|
||||||
@ -41,6 +42,8 @@ import static org.schabi.newpipe.extractor.ServiceList.YouTube;
|
|||||||
* Test for {@link StreamExtractor}
|
* Test for {@link StreamExtractor}
|
||||||
*/
|
*/
|
||||||
public class YoutubeStreamExtractorDefaultTest {
|
public class YoutubeStreamExtractorDefaultTest {
|
||||||
|
|
||||||
|
public static class AdeleHello {
|
||||||
private static YoutubeStreamExtractor extractor;
|
private static YoutubeStreamExtractor extractor;
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
@ -164,4 +167,36 @@ public class YoutubeStreamExtractorDefaultTest {
|
|||||||
// Video (/view?v=YQHsXMglC9A) set in the setUp() method has no captions => null
|
// Video (/view?v=YQHsXMglC9A) set in the setUp() method has no captions => null
|
||||||
assertTrue(extractor.getSubtitles(SubtitlesFormat.TTML).isEmpty());
|
assertTrue(extractor.getSubtitles(SubtitlesFormat.TTML).isEmpty());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class DescriptionTestPewdiepie {
|
||||||
|
private static YoutubeStreamExtractor extractor;
|
||||||
|
|
||||||
|
@BeforeClass
|
||||||
|
public static void setUp() throws Exception {
|
||||||
|
NewPipe.init(Downloader.getInstance());
|
||||||
|
extractor = (YoutubeStreamExtractor) YouTube
|
||||||
|
.getStreamExtractor("https://www.youtube.com/watch?v=dJY8iT341F4");
|
||||||
|
extractor.fetchPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetDescription() throws ParsingException {
|
||||||
|
assertNotNull(extractor.getDescription());
|
||||||
|
assertFalse(extractor.getDescription().isEmpty());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetFullLinksInDescriptlion() throws ParsingException {
|
||||||
|
assertTrue(extractor.getDescription().contains("https://www.reddit.com/r/PewdiepieSubmissions/"));
|
||||||
|
assertTrue(extractor.getDescription().contains("https://www.youtube.com/channel/UC3e8EMTOn4g6ZSKggHTnNng"));
|
||||||
|
|
||||||
|
assertFalse(extractor.getDescription().contains("https://www.reddit.com/r/PewdiepieSub..."));
|
||||||
|
assertFalse(extractor.getDescription().contains("https://usa.clutchchairz.com/product/..."));
|
||||||
|
assertFalse(extractor.getDescription().contains("https://europe.clutchchairz.com/en/pr..."));
|
||||||
|
assertFalse(extractor.getDescription().contains("https://canada.clutchchairz.com/produ..."));
|
||||||
|
assertFalse(extractor.getDescription().contains("http://store.steampowered.com/app/703..."));
|
||||||
|
assertFalse(extractor.getDescription().contains("https://www.youtube.com/channel/UC3e8..."));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user