diff --git a/build.gradle b/build.gradle index c91011258..19d7e7acb 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ allprojects { sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 - version 'v0.24.6' + version 'v0.24.7' group 'com.github.TeamNewPipe' repositories { diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/channel/tabs/ChannelTabs.java b/extractor/src/main/java/org/schabi/newpipe/extractor/channel/tabs/ChannelTabs.java index ae3b2661e..68b0ca430 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/channel/tabs/ChannelTabs.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/channel/tabs/ChannelTabs.java @@ -11,6 +11,7 @@ public final class ChannelTabs { public static final String CHANNELS = "channels"; public static final String PLAYLISTS = "playlists"; public static final String ALBUMS = "albums"; + public static final String LIKES = "likes"; private ChannelTabs() { } diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudParsingHelper.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudParsingHelper.java index 621bc360d..a03501b51 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudParsingHelper.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudParsingHelper.java @@ -25,6 +25,7 @@ import org.schabi.newpipe.extractor.exceptions.ParsingException; import org.schabi.newpipe.extractor.exceptions.ReCaptchaException; import org.schabi.newpipe.extractor.services.soundcloud.extractors.SoundcloudChannelInfoItemExtractor; import org.schabi.newpipe.extractor.services.soundcloud.extractors.SoundcloudPlaylistInfoItemExtractor; +import org.schabi.newpipe.extractor.services.soundcloud.extractors.SoundcloudLikesInfoItemExtractor; import org.schabi.newpipe.extractor.services.soundcloud.extractors.SoundcloudStreamInfoItemExtractor; import org.schabi.newpipe.extractor.stream.StreamInfoItemsCollector; import org.schabi.newpipe.extractor.utils.ImageSuffix; @@ -396,6 +397,9 @@ public final class SoundcloudParsingHelper { case "playlist": collector.commit(new SoundcloudPlaylistInfoItemExtractor(searchResult)); break; + case "like": + collector.commit(new SoundcloudLikesInfoItemExtractor(searchResult)); + break; } }); diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/extractors/SoundcloudChannelExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/extractors/SoundcloudChannelExtractor.java index d8cd186d5..3cad8782b 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/extractors/SoundcloudChannelExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/extractors/SoundcloudChannelExtractor.java @@ -123,6 +123,8 @@ public class SoundcloudChannelExtractor extends ChannelExtractor { + SoundcloudChannelTabLinkHandlerFactory.getUrlSuffix(ChannelTabs.PLAYLISTS); final String urlAlbums = url + SoundcloudChannelTabLinkHandlerFactory.getUrlSuffix(ChannelTabs.ALBUMS); + final String urlLikes = url + + SoundcloudChannelTabLinkHandlerFactory.getUrlSuffix(ChannelTabs.LIKES); final String id = getId(); return List.of( @@ -131,6 +133,8 @@ public class SoundcloudChannelExtractor extends ChannelExtractor { new ListLinkHandler(urlPlaylists, urlPlaylists, id, List.of(ChannelTabs.PLAYLISTS), ""), new ListLinkHandler(urlAlbums, urlAlbums, id, - List.of(ChannelTabs.ALBUMS), "")); + List.of(ChannelTabs.ALBUMS), ""), + new ListLinkHandler(urlLikes, urlLikes, id, + List.of(ChannelTabs.LIKES), "")); } } diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/extractors/SoundcloudChannelTabExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/extractors/SoundcloudChannelTabExtractor.java index a85daa0d9..30abe4fa9 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/extractors/SoundcloudChannelTabExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/extractors/SoundcloudChannelTabExtractor.java @@ -39,6 +39,8 @@ public class SoundcloudChannelTabExtractor extends ChannelTabExtractor { return "/playlists_without_albums"; case ChannelTabs.ALBUMS: return "/albums"; + case ChannelTabs.LIKES: + return "/likes"; } throw new ParsingException("Unsupported tab: " + getName()); } diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/extractors/SoundcloudLikesInfoItemExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/extractors/SoundcloudLikesInfoItemExtractor.java new file mode 100644 index 000000000..c1d27f74c --- /dev/null +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/extractors/SoundcloudLikesInfoItemExtractor.java @@ -0,0 +1,11 @@ +package org.schabi.newpipe.extractor.services.soundcloud.extractors; + +import com.grack.nanojson.JsonObject; + +public class SoundcloudLikesInfoItemExtractor extends SoundcloudStreamInfoItemExtractor { + + public SoundcloudLikesInfoItemExtractor(final JsonObject itemObject) { + super(itemObject.getObject("track")); + } + +} diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/linkHandler/SoundcloudChannelTabLinkHandlerFactory.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/linkHandler/SoundcloudChannelTabLinkHandlerFactory.java index 663e2a206..21e65f63c 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/linkHandler/SoundcloudChannelTabLinkHandlerFactory.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/linkHandler/SoundcloudChannelTabLinkHandlerFactory.java @@ -28,6 +28,8 @@ public final class SoundcloudChannelTabLinkHandlerFactory extends ListLinkHandle return "/sets"; case ChannelTabs.ALBUMS: return "/albums"; + case ChannelTabs.LIKES: + return "/likes"; } throw new UnsupportedTabException(tab); } @@ -56,6 +58,7 @@ public final class SoundcloudChannelTabLinkHandlerFactory extends ListLinkHandle ChannelTabs.TRACKS, ChannelTabs.PLAYLISTS, ChannelTabs.ALBUMS, + ChannelTabs.LIKES, }; } } diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelExtractorTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelExtractorTest.java index 7a6e2f1e3..93d262672 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelExtractorTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelExtractorTest.java @@ -99,7 +99,7 @@ public class SoundcloudChannelExtractorTest { @Override public void testTabs() throws Exception { assertTabsContain(extractor.getTabs(), ChannelTabs.TRACKS, ChannelTabs.PLAYLISTS, - ChannelTabs.ALBUMS); + ChannelTabs.ALBUMS, ChannelTabs.LIKES); } @Test @@ -187,7 +187,7 @@ public class SoundcloudChannelExtractorTest { @Override public void testTabs() throws Exception { assertTabsContain(extractor.getTabs(), ChannelTabs.TRACKS, ChannelTabs.PLAYLISTS, - ChannelTabs.ALBUMS); + ChannelTabs.ALBUMS, ChannelTabs.LIKES); } @Test diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelTabExtractorTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelTabExtractorTest.java index 475d15a69..1c4f86f8c 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelTabExtractorTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelTabExtractorTest.java @@ -94,4 +94,32 @@ class SoundcloudChannelTabExtractorTest { @Override public InfoItem.InfoType expectedInfoItemType() { return InfoItem.InfoType.PLAYLIST; } @Override public boolean expectedHasMoreItems() { return true; } } + + static class Likes extends DefaultListExtractorTest { + private static SoundcloudChannelTabExtractor extractor; + + @BeforeAll + static void setUp() throws IOException, ExtractionException { + NewPipe.init(DownloaderTestImpl.getInstance()); + extractor = (SoundcloudChannelTabExtractor) SoundCloud + .getChannelTabExtractorFromId("30854092", ChannelTabs.LIKES); + extractor.fetchPage(); + } + + @Override public ChannelTabExtractor extractor() throws Exception { return extractor; } + @Override public StreamingService expectedService() throws Exception { return SoundCloud; } + @Override public String expectedName() throws Exception { return ChannelTabs.LIKES; } + @Override public String expectedId() throws Exception { return "30854092"; } + @Override public String expectedUrlContains() throws Exception { return "https://soundcloud.com/lubenitza/likes"; } + @Override public String expectedOriginalUrlContains() throws Exception { return "https://soundcloud.com/lubenitza/likes"; } + @Override public InfoItem.InfoType expectedInfoItemType() { return InfoItem.InfoType.STREAM; } + @Override public boolean expectedHasMoreItems() { return true; } + + @Test + void testGetPageInNewExtractor() throws Exception { + final ChannelTabExtractor newTabExtractor = + SoundCloud.getChannelTabExtractorFromId("30854092", ChannelTabs.LIKES); + defaultTestGetPageInNewExtractor(extractor, newTabExtractor); + } + } }