|
20 | 20 |
|
21 | 21 | package org.schabi.newpipe.extractor.utils; |
22 | 22 |
|
23 | | -import org.nibor.autolink.LinkExtractor; |
24 | | -import org.nibor.autolink.LinkSpan; |
25 | | -import org.nibor.autolink.LinkType; |
| 23 | +import static org.schabi.newpipe.extractor.utils.Utils.UTF_8; |
| 24 | + |
26 | 25 | import org.schabi.newpipe.extractor.exceptions.ParsingException; |
27 | 26 |
|
28 | | -import javax.annotation.Nonnull; |
29 | 27 | import java.io.UnsupportedEncodingException; |
30 | 28 | import java.net.URLDecoder; |
31 | | -import java.util.ArrayList; |
32 | | -import java.util.EnumSet; |
33 | 29 | import java.util.HashMap; |
34 | | -import java.util.List; |
35 | 30 | import java.util.Map; |
36 | 31 | import java.util.regex.Matcher; |
37 | 32 | import java.util.regex.Pattern; |
38 | 33 |
|
39 | | -import static org.schabi.newpipe.extractor.utils.Utils.UTF_8; |
| 34 | +import javax.annotation.Nonnull; |
40 | 35 |
|
41 | 36 | /** |
42 | 37 | * Avoid using regex !!! |
@@ -111,24 +106,4 @@ public static Map<String, String> compatParseMap(@Nonnull final String input) |
111 | 106 | } |
112 | 107 | return map; |
113 | 108 | } |
114 | | - |
115 | | - @Nonnull |
116 | | - public static String[] getLinksFromString(final String txt) throws ParsingException { |
117 | | - try { |
118 | | - final List<String> links = new ArrayList<>(); |
119 | | - final LinkExtractor linkExtractor = LinkExtractor.builder() |
120 | | - .linkTypes(EnumSet.of(LinkType.URL, LinkType.WWW)) |
121 | | - .build(); |
122 | | - final Iterable<LinkSpan> linkSpans = linkExtractor.extractLinks(txt); |
123 | | - for (final LinkSpan ls : linkSpans) { |
124 | | - links.add(txt.substring(ls.getBeginIndex(), ls.getEndIndex())); |
125 | | - } |
126 | | - |
127 | | - String[] linksarray = new String[links.size()]; |
128 | | - linksarray = links.toArray(linksarray); |
129 | | - return linksarray; |
130 | | - } catch (final Exception e) { |
131 | | - throw new ParsingException("Could not get links from string", e); |
132 | | - } |
133 | | - } |
134 | 109 | } |
0 commit comments