Skip to content

Commit 0a5a905

Browse files
committed
Add final at more places
1 parent 17ba8a5 commit 0a5a905

3 files changed

Lines changed: 29 additions & 29 deletions

File tree

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,18 @@ public class SoundcloudChannelExtractor extends ChannelExtractor {
2727
private String userId;
2828
private JsonObject user;
2929

30-
public SoundcloudChannelExtractor(StreamingService service, ListLinkHandler linkHandler) {
30+
public SoundcloudChannelExtractor(final StreamingService service, final ListLinkHandler linkHandler) {
3131
super(service, linkHandler);
3232
}
3333

3434
@Override
35-
public void onFetchPage(@Nonnull Downloader downloader) throws IOException, ExtractionException {
35+
public void onFetchPage(@Nonnull final Downloader downloader) throws IOException, ExtractionException {
3636

3737
userId = getLinkHandler().getId();
38-
String apiUrl = "https://api-v2.soundcloud.com/users/" + userId +
38+
final String apiUrl = "https://api-v2.soundcloud.com/users/" + userId +
3939
"?client_id=" + SoundcloudParsingHelper.clientId();
4040

41-
String response = downloader.get(apiUrl, getExtractorLocalization()).responseBody();
41+
final String response = downloader.get(apiUrl, getExtractorLocalization()).responseBody();
4242
try {
4343
user = JsonParser.object().from(response);
4444
} catch (JsonParserException e) {
@@ -84,32 +84,32 @@ public String getDescription() {
8484
}
8585

8686
@Override
87-
public String getParentChannelName() throws ParsingException {
87+
public String getParentChannelName() {
8888
return "";
8989
}
9090

9191
@Override
92-
public String getParentChannelUrl() throws ParsingException {
92+
public String getParentChannelUrl() {
9393
return "";
9494
}
9595

9696
@Override
97-
public String getParentChannelAvatarUrl() throws ParsingException {
97+
public String getParentChannelAvatarUrl() {
9898
return "";
9999
}
100100

101101
@Nonnull
102102
@Override
103103
public InfoItemsPage<StreamInfoItem> getInitialPage() throws ExtractionException {
104104
try {
105-
StreamInfoItemsCollector streamInfoItemsCollector = new StreamInfoItemsCollector(getServiceId());
105+
final StreamInfoItemsCollector streamInfoItemsCollector = new StreamInfoItemsCollector(getServiceId());
106106

107-
String apiUrl = "https://api-v2.soundcloud.com/users/" + getId() + "/tracks"
107+
final String apiUrl = "https://api-v2.soundcloud.com/users/" + getId() + "/tracks"
108108
+ "?client_id=" + SoundcloudParsingHelper.clientId()
109109
+ "&limit=20"
110110
+ "&linked_partitioning=1";
111111

112-
String nextPageUrl = SoundcloudParsingHelper.getStreamsFromApiMinItems(15, streamInfoItemsCollector, apiUrl);
112+
final String nextPageUrl = SoundcloudParsingHelper.getStreamsFromApiMinItems(15, streamInfoItemsCollector, apiUrl);
113113

114114
return new InfoItemsPage<>(streamInfoItemsCollector, new Page(nextPageUrl));
115115
} catch (Exception e) {
@@ -123,8 +123,8 @@ public InfoItemsPage<StreamInfoItem> getPage(final Page page) throws IOException
123123
throw new IllegalArgumentException("Page doesn't contain an URL");
124124
}
125125

126-
StreamInfoItemsCollector collector = new StreamInfoItemsCollector(getServiceId());
127-
String nextPageUrl = SoundcloudParsingHelper.getStreamsFromApiMinItems(15, collector, page.getUrl());
126+
final StreamInfoItemsCollector collector = new StreamInfoItemsCollector(getServiceId());
127+
final String nextPageUrl = SoundcloudParsingHelper.getStreamsFromApiMinItems(15, collector, page.getUrl());
128128

129129
return new InfoItemsPage<>(collector, new Page(nextPageUrl));
130130
}

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public void onFetchPage(@Nonnull Downloader downloader) throws IOException, Extr
5454
}
5555

5656
private JsonObject getUploaderInfo() throws ParsingException {
57-
JsonArray items = initialData.getObject("sidebar").getObject("playlistSidebarRenderer").getArray("items");
57+
final JsonArray items = initialData.getObject("sidebar").getObject("playlistSidebarRenderer").getArray("items");
5858

5959
JsonObject videoOwner = items.getObject(1).getObject("playlistSidebarSecondaryInfoRenderer").getObject("videoOwner");
6060
if (videoOwner.has("videoOwnerRenderer")) {
@@ -81,7 +81,7 @@ private JsonObject getPlaylistInfo() throws ParsingException {
8181
@Nonnull
8282
@Override
8383
public String getName() throws ParsingException {
84-
String name = getTextFromObject(playlistInfo.getObject("title"));
84+
final String name = getTextFromObject(playlistInfo.getObject("title"));
8585
if (name != null && !name.isEmpty()) return name;
8686

8787
return initialData.getObject("microformat").getObject("microformatDataRenderer").getString("title");
@@ -130,7 +130,7 @@ public String getUploaderName() throws ParsingException {
130130
@Override
131131
public String getUploaderAvatarUrl() throws ParsingException {
132132
try {
133-
String url = getUploaderInfo().getObject("thumbnail").getArray("thumbnails").getObject(0).getString("url");
133+
final String url = getUploaderInfo().getObject("thumbnail").getArray("thumbnails").getObject(0).getString("url");
134134

135135
return fixThumbnailUrl(url);
136136
} catch (Exception e) {
@@ -141,7 +141,7 @@ public String getUploaderAvatarUrl() throws ParsingException {
141141
@Override
142142
public long getStreamCount() throws ParsingException {
143143
try {
144-
String viewsText = getTextFromObject(getPlaylistInfo().getArray("stats").getObject(0));
144+
final String viewsText = getTextFromObject(getPlaylistInfo().getArray("stats").getObject(0));
145145
return Long.parseLong(Utils.removeNonDigitCharacters(viewsText));
146146
} catch (Exception e) {
147147
throw new ParsingException("Could not get video count from playlist", e);
@@ -220,17 +220,17 @@ private Page getNextPageFrom(final JsonArray continuations) {
220220
return null;
221221
}
222222

223-
JsonObject nextContinuationData = continuations.getObject(0).getObject("nextContinuationData");
224-
String continuation = nextContinuationData.getString("continuation");
225-
String clickTrackingParams = nextContinuationData.getString("clickTrackingParams");
223+
final JsonObject nextContinuationData = continuations.getObject(0).getObject("nextContinuationData");
224+
final String continuation = nextContinuationData.getString("continuation");
225+
final String clickTrackingParams = nextContinuationData.getString("clickTrackingParams");
226226
return new Page("https://www.youtube.com/browse_ajax?ctoken=" + continuation + "&continuation=" + continuation
227227
+ "&itct=" + clickTrackingParams);
228228
}
229229

230230
private void collectStreamsFrom(final StreamInfoItemsCollector collector, final JsonArray videos) {
231231
final TimeAgoParser timeAgoParser = getTimeAgoParser();
232232

233-
for (Object video : videos) {
233+
for (final Object video : videos) {
234234
if (((JsonObject) video).has("playlistVideoRenderer")) {
235235
collector.commit(new YoutubeStreamInfoItemExtractor(((JsonObject) video).getObject("playlistVideoRenderer"), timeAgoParser) {
236236
@Override

extractor/src/test/java/org/schabi/newpipe/extractor/services/peertube/PeertubeCommentsExtractorTest.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,33 +35,33 @@ public static void setUp() throws Exception {
3535
public void testGetComments() throws IOException, ExtractionException {
3636
InfoItemsPage<CommentsInfoItem> comments = extractor.getInitialPage();
3737
boolean result = findInComments(comments, "@root A great documentary on a great guy.");
38-
38+
3939
while (comments.hasNextPage() && !result) {
4040
comments = extractor.getPage(comments.getNextPage());
4141
result = findInComments(comments, "@root A great documentary on a great guy.");
4242
}
43-
43+
4444
assertTrue(result);
4545
}
46-
46+
4747
@Test
4848
public void testGetCommentsFromCommentsInfo() throws IOException, ExtractionException {
4949
CommentsInfo commentsInfo = CommentsInfo.getInfo("https://framatube.org/videos/watch/a8ea95b8-0396-49a6-8f30-e25e25fb2828");
5050
assertEquals("Comments", commentsInfo.getName());
51-
51+
5252
boolean result = findInComments(commentsInfo.getRelatedItems(), "Loved it!!!");
53-
53+
5454
Page nextPage = commentsInfo.getNextPage();
5555
InfoItemsPage<CommentsInfoItem> moreItems = new InfoItemsPage<>(null, nextPage, null);
5656
while (moreItems.hasNextPage() && !result) {
5757
moreItems = CommentsInfo.getMoreItems(PeerTube, commentsInfo, nextPage);
5858
result = findInComments(moreItems.getItems(), "Loved it!!!");
5959
nextPage = moreItems.getNextPage();
6060
}
61-
61+
6262
assertTrue(result);
6363
}
64-
64+
6565
@Test
6666
public void testGetCommentsAllData() throws IOException, ExtractionException {
6767
InfoItemsPage<CommentsInfoItem> comments = extractor.getInitialPage();
@@ -78,11 +78,11 @@ public void testGetCommentsAllData() throws IOException, ExtractionException {
7878
assertFalse(c.getLikeCount() != -1);
7979
}
8080
}
81-
81+
8282
private boolean findInComments(InfoItemsPage<CommentsInfoItem> comments, String comment) {
8383
return findInComments(comments.getItems(), comment);
8484
}
85-
85+
8686
private boolean findInComments(List<CommentsInfoItem> comments, String comment) {
8787
for (CommentsInfoItem c : comments) {
8888
if (c.getCommentText().contains(comment)) {

0 commit comments

Comments
 (0)