Skip to content

Commit 81f2911

Browse files
switch from string to Description object
1 parent e147867 commit 81f2911

7 files changed

Lines changed: 29 additions & 17 deletions

File tree

extractor/src/main/java/org/schabi/newpipe/extractor/playlist/PlaylistExtractor.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import org.schabi.newpipe.extractor.StreamingService;
55
import org.schabi.newpipe.extractor.exceptions.ParsingException;
66
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandler;
7+
import org.schabi.newpipe.extractor.stream.Description;
78
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
89

910
import javax.annotation.Nonnull;
@@ -21,7 +22,7 @@ public PlaylistExtractor(final StreamingService service, final ListLinkHandler l
2122

2223
public abstract long getStreamCount() throws ParsingException;
2324

24-
public abstract String getDescription() throws ParsingException;
25+
public abstract Description getDescription() throws ParsingException;
2526

2627
@Nonnull
2728
public String getThumbnailUrl() throws ParsingException {

extractor/src/main/java/org/schabi/newpipe/extractor/services/bandcamp/extractors/BandcampPlaylistExtractor.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandler;
2121
import org.schabi.newpipe.extractor.playlist.PlaylistExtractor;
2222
import org.schabi.newpipe.extractor.services.bandcamp.extractors.streaminfoitem.BandcampPlaylistStreamInfoItemExtractor;
23+
import org.schabi.newpipe.extractor.stream.Description;
2324
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
2425
import org.schabi.newpipe.extractor.stream.StreamInfoItemsCollector;
2526

@@ -109,8 +110,8 @@ public long getStreamCount() {
109110
}
110111

111112
@Override
112-
public String getDescription() throws ParsingException {
113-
return "";
113+
public Description getDescription() throws ParsingException {
114+
return Description.EMPTY_DESCRIPTION;
114115
}
115116

116117
@Nonnull

extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/extractors/PeertubePlaylistExtractor.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandler;
1313
import org.schabi.newpipe.extractor.playlist.PlaylistExtractor;
1414
import org.schabi.newpipe.extractor.services.peertube.PeertubeParsingHelper;
15+
import org.schabi.newpipe.extractor.stream.Description;
1516
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
1617
import org.schabi.newpipe.extractor.stream.StreamInfoItemsCollector;
1718
import org.schabi.newpipe.extractor.utils.Utils;
@@ -66,8 +67,8 @@ public long getStreamCount() {
6667
}
6768

6869
@Override
69-
public String getDescription() throws ParsingException {
70-
return "";
70+
public Description getDescription() throws ParsingException {
71+
return Description.EMPTY_DESCRIPTION;
7172
}
7273

7374
@Nonnull

extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/extractors/SoundcloudPlaylistExtractor.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandler;
1414
import org.schabi.newpipe.extractor.playlist.PlaylistExtractor;
1515
import org.schabi.newpipe.extractor.services.soundcloud.SoundcloudParsingHelper;
16+
import org.schabi.newpipe.extractor.stream.Description;
1617
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
1718
import org.schabi.newpipe.extractor.stream.StreamInfoItemsCollector;
1819

@@ -119,8 +120,8 @@ public long getStreamCount() {
119120
}
120121

121122
@Override
122-
public String getDescription() throws ParsingException {
123-
return "";
123+
public Description getDescription() throws ParsingException {
124+
return Description.EMPTY_DESCRIPTION;
124125
}
125126

126127
@Nonnull

extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeMixPlaylistExtractor.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import org.schabi.newpipe.extractor.playlist.PlaylistExtractor;
3232
import org.schabi.newpipe.extractor.playlist.PlaylistInfo;
3333
import org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper;
34+
import org.schabi.newpipe.extractor.stream.Description;
3435
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
3536
import org.schabi.newpipe.extractor.stream.StreamInfoItemsCollector;
3637
import org.schabi.newpipe.extractor.utils.JsonUtils;
@@ -170,8 +171,8 @@ public long getStreamCount() {
170171
}
171172

172173
@Override
173-
public String getDescription() throws ParsingException {
174-
return "";
174+
public Description getDescription() throws ParsingException {
175+
return Description.EMPTY_DESCRIPTION;
175176
}
176177

177178
@Nonnull

extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubePlaylistExtractor.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import org.schabi.newpipe.extractor.playlist.PlaylistExtractor;
2727
import org.schabi.newpipe.extractor.playlist.PlaylistInfo;
2828
import org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper;
29+
import org.schabi.newpipe.extractor.stream.Description;
2930
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
3031
import org.schabi.newpipe.extractor.stream.StreamInfoItemsCollector;
3132
import org.schabi.newpipe.extractor.utils.Utils;
@@ -295,8 +296,13 @@ public long getStreamCount() throws ParsingException {
295296
}
296297

297298
@Override
298-
public String getDescription() throws ParsingException {
299-
return getTextFromObject(getPlaylistInfo().getObject("description"));
299+
public Description getDescription() throws ParsingException {
300+
final String description = getTextFromObject(
301+
getPlaylistInfo().getObject("description"),
302+
true
303+
);
304+
305+
return new Description(description, Description.HTML);
300306
}
301307

302308
@Nonnull

extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubePlaylistExtractorTest.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import org.schabi.newpipe.extractor.playlist.PlaylistInfo;
2727
import org.schabi.newpipe.extractor.services.BasePlaylistExtractorTest;
2828
import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubePlaylistExtractor;
29+
import org.schabi.newpipe.extractor.stream.Description;
2930
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
3031

3132
import java.io.IOException;
@@ -167,8 +168,8 @@ void getPlaylistType() throws ParsingException {
167168

168169
@Test
169170
public void testDescription() throws ParsingException {
170-
final String description = extractor.getDescription();
171-
assertContains("pop songs list", description);
171+
final Description description = extractor.getDescription();
172+
assertContains("pop songs list", description.getContent());
172173
}
173174
}
174175

@@ -296,8 +297,8 @@ void getPlaylistType() throws ParsingException {
296297

297298
@Test
298299
public void testDescription() throws ParsingException {
299-
final String description = extractor.getDescription();
300-
assertContains("I Wanna Rock Super Gigantic Playlist", description);
300+
final Description description = extractor.getDescription();
301+
assertContains("I Wanna Rock Super Gigantic Playlist", description.getContent());
301302
}
302303
}
303304

@@ -410,8 +411,8 @@ void getPlaylistType() throws ParsingException {
410411

411412
@Test
412413
public void testDescription() throws ParsingException {
413-
final String description = extractor.getDescription();
414-
assertContains("47 episodes", description);
414+
final Description description = extractor.getDescription();
415+
assertContains("47 episodes", description.getContent());
415416
}
416417
}
417418

0 commit comments

Comments
 (0)