Merge branch 'dev' of github.com:TeamNewPipe/NewPipeExtractor into channel-tabs

This commit is contained in:
ThetaDev 2023-05-01 17:56:52 +02:00
commit d868746e50
5 changed files with 22 additions and 21 deletions

View File

@ -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

View File

@ -18,13 +18,13 @@ import org.schabi.newpipe.extractor.services.peertube.linkHandler.PeertubeChanne
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;
@ -86,13 +86,10 @@ public class PeertubeAccountExtractor extends ChannelExtractor {
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

View File

@ -16,13 +16,13 @@ import org.schabi.newpipe.extractor.services.peertube.linkHandler.PeertubeChanne
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;
@ -59,13 +59,10 @@ public class PeertubeChannelExtractor extends ChannelExtractor {
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

View File

@ -13,7 +13,11 @@ import org.schabi.newpipe.extractor.services.peertube.extractors.PeertubeAccount
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;
@ -76,7 +80,7 @@ public class PeertubeAccountExtractorTest {
@Test
@Override
public void testDescription() throws ParsingException {
assertNotNull(extractor.getDescription());
assertNull(extractor.getDescription());
}
@Test

View File

@ -28,7 +28,7 @@ public class YouTubeChannelTabExtractorTest {
YoutubeTestsUtils.ensureStateless();
NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "playlists"));
extractor = (YoutubeChannelTabExtractor) YouTube.getChannelTabExtractorFromId(
"UC2DjFE7Xf11URZqWBigcVOQ", ChannelTabs.PLAYLISTS);
"channel/UC2DjFE7Xf11URZqWBigcVOQ", ChannelTabs.PLAYLISTS);
extractor.fetchPage();
}
@ -87,7 +87,8 @@ public class YouTubeChannelTabExtractorTest {
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();
}
@ -145,7 +146,8 @@ public class YouTubeChannelTabExtractorTest {
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();
}
@ -203,7 +205,8 @@ public class YouTubeChannelTabExtractorTest {
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();
}