Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:TeamNewPipe/NewPipeExtractor into ch…
Browse files Browse the repository at this point in the history
…annel-tabs
  • Loading branch information
Theta-Dev committed May 1, 2023
2 parents a3f6a7e + 11565db commit d868746
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
# See gradle file for difference between downloaders
- name: Build and run Tests
run: |
if [[ $GITHUB_EVENT_NAME == 'schedule' ]]; then
if [[ "$GITHUB_EVENT_NAME" == 'schedule' ]]; then
echo running with real downloader
./gradlew check --stacktrace -Ddownloader=REAL
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
import org.schabi.newpipe.extractor.services.peertube.linkHandler.PeertubeChannelTabLinkHandlerFactory;
import org.schabi.newpipe.extractor.utils.JsonUtils;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import javax.annotation.Nonnull;

public class PeertubeAccountExtractor extends ChannelExtractor {
private JsonObject json;
private final String baseUrl;
Expand Down Expand Up @@ -86,13 +86,10 @@ public long getSubscriberCount() throws ParsingException {
return subscribersCount;
}

@Nullable
@Override
public String getDescription() {
try {
return JsonUtils.getString(json, "description");
} catch (final ParsingException e) {
return "No description";
}
return json.getString("description");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
import org.schabi.newpipe.extractor.services.peertube.linkHandler.PeertubeChannelTabLinkHandlerFactory;
import org.schabi.newpipe.extractor.utils.JsonUtils;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import javax.annotation.Nonnull;

public class PeertubeChannelExtractor extends ChannelExtractor {
private JsonObject json;
private final String baseUrl;
Expand Down Expand Up @@ -59,13 +59,10 @@ public long getSubscriberCount() {
return json.getLong("followersCount");
}

@Nullable
@Override
public String getDescription() {
try {
return JsonUtils.getString(json, "description");
} catch (final ParsingException e) {
return "No description";
}
return json.getString("description");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
import java.util.Set;
import java.util.stream.Collectors;

import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertIsSecureUrl;
import static org.schabi.newpipe.extractor.ServiceList.PeerTube;

Expand Down Expand Up @@ -76,7 +80,7 @@ public void testOriginalUrl() throws ParsingException {
@Test
@Override
public void testDescription() throws ParsingException {
assertNotNull(extractor.getDescription());
assertNull(extractor.getDescription());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static void setUp() throws IOException, ExtractionException {
YoutubeTestsUtils.ensureStateless();
NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "playlists"));
extractor = (YoutubeChannelTabExtractor) YouTube.getChannelTabExtractorFromId(
"UC2DjFE7Xf11URZqWBigcVOQ", ChannelTabs.PLAYLISTS);
"channel/UC2DjFE7Xf11URZqWBigcVOQ", ChannelTabs.PLAYLISTS);
extractor.fetchPage();
}

Expand Down Expand Up @@ -87,7 +87,8 @@ public static class Channels implements BaseListExtractorTest {
public static void setUp() throws IOException, ExtractionException {
YoutubeTestsUtils.ensureStateless();
NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "channels"));
extractor = (YoutubeChannelTabExtractor) YouTube.getChannelTabExtractorFromId("UC2DjFE7Xf11URZqWBigcVOQ", ChannelTabs.CHANNELS);
extractor = (YoutubeChannelTabExtractor) YouTube.getChannelTabExtractorFromId(
"channel/UC2DjFE7Xf11URZqWBigcVOQ", ChannelTabs.CHANNELS);
extractor.fetchPage();
}

Expand Down Expand Up @@ -145,7 +146,8 @@ public static class Livestreams implements BaseListExtractorTest {
public static void setUp() throws IOException, ExtractionException {
YoutubeTestsUtils.ensureStateless();
NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "livestreams"));
extractor = (YoutubeChannelTabExtractor) YouTube.getChannelTabExtractorFromId("UCR-DXc1voovS8nhAvccRZhg", ChannelTabs.LIVESTREAMS);
extractor = (YoutubeChannelTabExtractor) YouTube.getChannelTabExtractorFromId(
"channel/UCR-DXc1voovS8nhAvccRZhg", ChannelTabs.LIVESTREAMS);
extractor.fetchPage();
}

Expand Down Expand Up @@ -203,7 +205,8 @@ public static class Shorts implements BaseListExtractorTest {
public static void setUp() throws IOException, ExtractionException {
YoutubeTestsUtils.ensureStateless();
NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "shorts"));
extractor = (YoutubeChannelTabExtractor) YouTube.getChannelTabExtractorFromId("UCh8gHdtzO2tXd593_bjErWg", ChannelTabs.SHORTS);
extractor = (YoutubeChannelTabExtractor) YouTube.getChannelTabExtractorFromId(
"channel/UCh8gHdtzO2tXd593_bjErWg", ChannelTabs.SHORTS);
extractor.fetchPage();
}

Expand Down

0 comments on commit d868746

Please sign in to comment.