Skip to content

Commit 557934c

Browse files
committed
use EMPTY_STRING
1 parent 9ca52ca commit 557934c

23 files changed

Lines changed: 83 additions & 103 deletions

extractor/src/main/java/org/schabi/newpipe/extractor/kiosk/KioskList.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
import java.util.Map;
1515
import java.util.Set;
1616

17+
import static org.schabi.newpipe.extractor.utils.Utils.isNullOrEmpty;
18+
1719
public class KioskList {
1820

1921
public interface KioskExtractorFactory {
@@ -70,7 +72,7 @@ public KioskExtractor getDefaultKioskExtractor(Page nextPage)
7072

7173
public KioskExtractor getDefaultKioskExtractor(Page nextPage, Localization localization)
7274
throws ExtractionException, IOException {
73-
if (defaultKiosk != null && !defaultKiosk.equals("")) {
75+
if (!isNullOrEmpty(defaultKiosk)) {
7476
return getExtractorById(defaultKiosk, nextPage, localization);
7577
} else {
7678
if (!kioskList.isEmpty()) {

extractor/src/main/java/org/schabi/newpipe/extractor/linkhandler/SearchQueryHandlerFactory.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import java.util.ArrayList;
66
import java.util.List;
77

8+
import static org.schabi.newpipe.extractor.utils.Utils.EMPTY_STRING;
9+
810
public abstract class SearchQueryHandlerFactory extends ListLinkHandlerFactory {
911

1012
///////////////////////////////////
@@ -28,14 +30,14 @@ public String getId(String url) {
2830
}
2931

3032
@Override
31-
public SearchQueryHandler fromQuery(String querry,
33+
public SearchQueryHandler fromQuery(String query,
3234
List<String> contentFilter,
3335
String sortFilter) throws ParsingException {
34-
return new SearchQueryHandler(super.fromQuery(querry, contentFilter, sortFilter));
36+
return new SearchQueryHandler(super.fromQuery(query, contentFilter, sortFilter));
3537
}
3638

37-
public SearchQueryHandler fromQuery(String querry) throws ParsingException {
38-
return fromQuery(querry, new ArrayList<String>(0), "");
39+
public SearchQueryHandler fromQuery(String query) throws ParsingException {
40+
return fromQuery(query, new ArrayList<String>(0), EMPTY_STRING);
3941
}
4042

4143
/**

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package org.schabi.newpipe.extractor.services.peertube.extractors;
22

33
import com.grack.nanojson.JsonObject;
4-
54
import org.jsoup.Jsoup;
65
import org.jsoup.nodes.Document;
76
import org.schabi.newpipe.extractor.ServiceList;
@@ -13,6 +12,8 @@
1312

1413
import java.util.Objects;
1514

15+
import static org.schabi.newpipe.extractor.utils.Utils.EMPTY_STRING;
16+
1617
public class PeertubeCommentsInfoItemExtractor implements CommentsInfoItemExtractor {
1718
private final JsonObject item;
1819
private final String url;
@@ -68,7 +69,7 @@ public String getCommentText() throws ParsingException {
6869
final Document doc = Jsoup.parse(htmlText);
6970
return doc.body().text();
7071
} catch (Exception e) {
71-
return htmlText.replaceAll("(?s)<[^>]*>(\\s*<[^>]*>)*", "");
72+
return htmlText.replaceAll("(?s)<[^>]*>(\\s*<[^>]*>)*", EMPTY_STRING);
7273
}
7374
}
7475

extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudParsingHelper.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737

3838
import static java.util.Collections.singletonList;
3939
import static org.schabi.newpipe.extractor.ServiceList.SoundCloud;
40-
import static org.schabi.newpipe.extractor.utils.JsonUtils.EMPTY_STRING;
4140
import static org.schabi.newpipe.extractor.utils.Utils.*;
4241

4342
public class SoundcloudParsingHelper {

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import com.grack.nanojson.JsonObject;
44
import com.grack.nanojson.JsonParser;
55
import com.grack.nanojson.JsonParserException;
6-
76
import org.schabi.newpipe.extractor.Page;
87
import org.schabi.newpipe.extractor.StreamingService;
98
import org.schabi.newpipe.extractor.channel.ChannelExtractor;
@@ -15,11 +14,10 @@
1514
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
1615
import org.schabi.newpipe.extractor.stream.StreamInfoItemsCollector;
1716

18-
import java.io.IOException;
19-
2017
import javax.annotation.Nonnull;
18+
import java.io.IOException;
2119

22-
import static org.schabi.newpipe.extractor.utils.JsonUtils.EMPTY_STRING;
20+
import static org.schabi.newpipe.extractor.utils.Utils.EMPTY_STRING;
2321
import static org.schabi.newpipe.extractor.utils.Utils.isNullOrEmpty;
2422

2523
@SuppressWarnings("WeakerAccess")

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import com.grack.nanojson.JsonObject;
44
import org.schabi.newpipe.extractor.channel.ChannelInfoItemExtractor;
55

6-
import static org.schabi.newpipe.extractor.utils.JsonUtils.EMPTY_STRING;
6+
import static org.schabi.newpipe.extractor.utils.Utils.EMPTY_STRING;
77
import static org.schabi.newpipe.extractor.utils.Utils.replaceHttpWithHttps;
88

99
public class SoundcloudChannelInfoItemExtractor implements ChannelInfoItemExtractor {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import org.schabi.newpipe.extractor.exceptions.ParsingException;
55
import org.schabi.newpipe.extractor.playlist.PlaylistInfoItemExtractor;
66

7-
import static org.schabi.newpipe.extractor.utils.JsonUtils.EMPTY_STRING;
7+
import static org.schabi.newpipe.extractor.utils.Utils.EMPTY_STRING;
88
import static org.schabi.newpipe.extractor.utils.Utils.replaceHttpWithHttps;
99

1010
public class SoundcloudPlaylistInfoItemExtractor implements PlaylistInfoItemExtractor {

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

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,7 @@
44
import com.grack.nanojson.JsonObject;
55
import com.grack.nanojson.JsonParser;
66
import com.grack.nanojson.JsonParserException;
7-
8-
import org.schabi.newpipe.extractor.InfoItem;
9-
import org.schabi.newpipe.extractor.InfoItemExtractor;
10-
import org.schabi.newpipe.extractor.InfoItemsCollector;
11-
import org.schabi.newpipe.extractor.MetaInfo;
12-
import org.schabi.newpipe.extractor.Page;
13-
import org.schabi.newpipe.extractor.StreamingService;
7+
import org.schabi.newpipe.extractor.*;
148
import org.schabi.newpipe.extractor.downloader.Downloader;
159
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
1610
import org.schabi.newpipe.extractor.exceptions.ParsingException;
@@ -19,17 +13,16 @@
1913
import org.schabi.newpipe.extractor.search.SearchExtractor;
2014
import org.schabi.newpipe.extractor.utils.Parser;
2115

16+
import javax.annotation.Nonnull;
2217
import java.io.IOException;
2318
import java.io.UnsupportedEncodingException;
2419
import java.net.MalformedURLException;
2520
import java.net.URL;
2621
import java.util.Collections;
2722
import java.util.List;
2823

29-
import javax.annotation.Nonnull;
30-
3124
import static org.schabi.newpipe.extractor.services.soundcloud.linkHandler.SoundcloudSearchQueryHandlerFactory.ITEMS_PER_PAGE;
32-
import static org.schabi.newpipe.extractor.utils.JsonUtils.EMPTY_STRING;
25+
import static org.schabi.newpipe.extractor.utils.Utils.EMPTY_STRING;
3326
import static org.schabi.newpipe.extractor.utils.Utils.isNullOrEmpty;
3427

3528
public class SoundcloudSearchExtractor extends SearchExtractor {
@@ -50,7 +43,7 @@ public boolean isCorrectedSearch() {
5043
return false;
5144
}
5245

53-
@Nonnull
46+
@Nonnull
5447
@Override
5548
public List<MetaInfo> getMetaInfo() {
5649
return Collections.emptyList();

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@
2828
import java.util.List;
2929
import java.util.Locale;
3030

31-
import static org.schabi.newpipe.extractor.utils.JsonUtils.EMPTY_STRING;
32-
import static org.schabi.newpipe.extractor.utils.Utils.UTF_8;
33-
import static org.schabi.newpipe.extractor.utils.Utils.isNullOrEmpty;
31+
import static org.schabi.newpipe.extractor.utils.Utils.*;
3432

3533
public class SoundcloudStreamExtractor extends StreamExtractor {
3634
private JsonObject track;
@@ -52,7 +50,7 @@ public void onFetchPage(@Nonnull Downloader downloader) throws IOException, Extr
5250
@Nonnull
5351
@Override
5452
public String getId() {
55-
return track.getInt("id") + "";
53+
return track.getInt("id") + EMPTY_STRING;
5654
}
5755

5856
@Nonnull
@@ -66,7 +64,7 @@ public String getName() {
6664
public String getTextualUploadDate() {
6765
return track.getString("created_at")
6866
.replace("T", " ")
69-
.replace("Z", "");
67+
.replace("Z", EMPTY_STRING);
7068
}
7169

7270
@Nonnull

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import org.schabi.newpipe.extractor.stream.StreamInfoItemExtractor;
88
import org.schabi.newpipe.extractor.stream.StreamType;
99

10-
import static org.schabi.newpipe.extractor.utils.JsonUtils.EMPTY_STRING;
10+
import static org.schabi.newpipe.extractor.utils.Utils.EMPTY_STRING;
1111
import static org.schabi.newpipe.extractor.utils.Utils.replaceHttpWithHttps;
1212

1313
public class SoundcloudStreamInfoItemExtractor implements StreamInfoItemExtractor {

0 commit comments

Comments
 (0)