roleback using href for description links

This commit is contained in:
Christian Schabesberger 2018-08-28 11:55:12 +02:00
parent 3aa7ff6d0e
commit fef71aeccc
2 changed files with 3 additions and 3 deletions

View file

@ -176,12 +176,12 @@ public class YoutubeStreamExtractor extends StreamExtractor {
if(link != null) { if(link != null) {
// if link is null the a tag is a hashtag. // if link is null the a tag is a hashtag.
// They refer to the youtube search. We do not handle them. // They refer to the youtube search. We do not handle them.
a.attr("abs:href", link); a.text(link);
} else if(redirectLink.toString().contains("watch?v=")) { } else if(redirectLink.toString().contains("watch?v=")) {
// Another posibility is that this link is pointing to another video // Another posibility is that this link is pointing to another video
// we need to put the redirectLink in here explicitly in order to add the domain part to the link. // we need to put the redirectLink in here explicitly in order to add the domain part to the link.
a.attr("abs:href", redirectLink.toString()); a.text(redirectLink.toString());
} }
} }
} }

View file

@ -77,7 +77,7 @@ public class YoutubeStreamExtractorDefaultTest {
@Test @Test
public void testGetFullLinksInDescriptlion() throws ParsingException { public void testGetFullLinksInDescriptlion() throws ParsingException {
assertTrue(extractor.getDescription().contains("http://smarturl.it/SubscribeAdele?IQid=yt")); assertTrue(extractor.getDescription().contains("http://smarturl.it/SubscribeAdele?IQid=yt"));
assertTrue(extractor.getDescription().contains("http://smarturl.it/SubscribeAdele?IQi...")); assertFalse(extractor.getDescription().contains("http://smarturl.it/SubscribeAdele?IQi..."));
} }
@Test @Test