From 4b134a3b23504d4a99facf2365fde86a55eeccae Mon Sep 17 00:00:00 2001 From: Somethingweirdhere Date: Wed, 16 May 2018 00:15:00 +0200 Subject: [PATCH 1/5] Fixed longer links not working by changing their href to the link they should redirect to. --- .../extractors/YoutubeStreamExtractor.java | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java index 87571e8b7..6718951c2 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java @@ -24,6 +24,7 @@ import org.schabi.newpipe.extractor.utils.Utils; import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.io.IOException; +import java.io.UnsupportedEncodingException; import java.util.*; /* @@ -151,12 +152,44 @@ public class YoutubeStreamExtractor extends StreamExtractor { public String getDescription() throws ParsingException { assertPageFetched(); try { - return doc.select("p[id=\"eow-description\"]").first().html(); + return fixDescriptionLinks(doc.select("p[id=\"eow-description\"]").first().html()); } catch (Exception e) {//todo: add fallback method <-- there is no ... as long as i know throw new ParsingException("Could not get the description", e); } } + private String fixDescriptionLinks(String description) throws ParsingException, UnsupportedEncodingException { + boolean everythingIsFine = true; + String descriptionE = java.net.URLDecoder.decode(description, "UTF-8"); + Parser.getLinksFromString(descriptionE); + int endlessloop = 0; + while(everythingIsFine) { + try { + String[] FirstCut = description.split("