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.
|
||||
a.text(link);
|
||||
|
||||
}
|
||||
} else if(redirectLink.toString().contains("watch?v=")
|
||||
|| redirectLink.toString().contains("https://www.youtube.com/")) {
|
||||
// Another posibility is that this link is pointing to another video
|
||||
|
@ -185,7 +186,6 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
|||
a.text(redirectLink.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
return description.select("body").first().html();
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ import java.io.IOException;
|
|||
import static org.junit.Assert.*;
|
||||
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertIsSecureUrl;
|
||||
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.
|
||||
|
@ -41,6 +42,8 @@ import static org.schabi.newpipe.extractor.ServiceList.YouTube;
|
|||
* Test for {@link StreamExtractor}
|
||||
*/
|
||||
public class YoutubeStreamExtractorDefaultTest {
|
||||
|
||||
public static class AdeleHello {
|
||||
private static YoutubeStreamExtractor extractor;
|
||||
|
||||
@BeforeClass
|
||||
|
@ -165,3 +168,35 @@ public class YoutubeStreamExtractorDefaultTest {
|
|||
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…
Reference in New Issue