Skip to content

Commit a9303b2

Browse files
authored
Merge pull request #445 from B0pol/peertube_fix
[PeerTube] fix account and channel extractors
2 parents bcc01b9 + b21e599 commit a9303b2

4 files changed

Lines changed: 9 additions & 21 deletions

File tree

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

Lines changed: 3 additions & 8 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;
@@ -19,14 +18,10 @@
1918
import org.schabi.newpipe.extractor.utils.JsonUtils;
2019
import org.schabi.newpipe.extractor.utils.Utils;
2120

22-
import java.io.IOException;
23-
2421
import javax.annotation.Nonnull;
22+
import java.io.IOException;
2523

26-
import static org.schabi.newpipe.extractor.services.peertube.PeertubeParsingHelper.COUNT_KEY;
27-
import static org.schabi.newpipe.extractor.services.peertube.PeertubeParsingHelper.ITEMS_PER_PAGE;
28-
import static org.schabi.newpipe.extractor.services.peertube.PeertubeParsingHelper.START_KEY;
29-
import static org.schabi.newpipe.extractor.services.peertube.PeertubeParsingHelper.collectStreamsFrom;
24+
import static org.schabi.newpipe.extractor.services.peertube.PeertubeParsingHelper.*;
3025
import static org.schabi.newpipe.extractor.utils.Utils.isNullOrEmpty;
3126

3227
public class PeertubeAccountExtractor extends ChannelExtractor {
@@ -92,7 +87,7 @@ public String getParentChannelAvatarUrl() {
9287
@Override
9388
public InfoItemsPage<StreamInfoItem> getInitialPage() throws IOException, ExtractionException {
9489
return getPage(new Page(
95-
getUrl() + "/videos?" + START_KEY + "=0&" + COUNT_KEY + "=" + ITEMS_PER_PAGE));
90+
baseUrl + "/api/v1/" + getId() + "/videos?" + START_KEY + "=0&" + COUNT_KEY + "=" + ITEMS_PER_PAGE));
9691
}
9792

9893
@Override

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

Lines changed: 3 additions & 8 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;
@@ -19,14 +18,10 @@
1918
import org.schabi.newpipe.extractor.utils.JsonUtils;
2019
import org.schabi.newpipe.extractor.utils.Utils;
2120

22-
import java.io.IOException;
23-
2421
import javax.annotation.Nonnull;
22+
import java.io.IOException;
2523

26-
import static org.schabi.newpipe.extractor.services.peertube.PeertubeParsingHelper.COUNT_KEY;
27-
import static org.schabi.newpipe.extractor.services.peertube.PeertubeParsingHelper.ITEMS_PER_PAGE;
28-
import static org.schabi.newpipe.extractor.services.peertube.PeertubeParsingHelper.START_KEY;
29-
import static org.schabi.newpipe.extractor.services.peertube.PeertubeParsingHelper.collectStreamsFrom;
24+
import static org.schabi.newpipe.extractor.services.peertube.PeertubeParsingHelper.*;
3025
import static org.schabi.newpipe.extractor.utils.Utils.isNullOrEmpty;
3126

3227

@@ -99,7 +94,7 @@ public String getParentChannelAvatarUrl() {
9994
@Override
10095
public InfoItemsPage<StreamInfoItem> getInitialPage() throws IOException, ExtractionException {
10196
return getPage(new Page(
102-
getUrl() + "/videos?" + START_KEY + "=0&" + COUNT_KEY + "=" + ITEMS_PER_PAGE));
97+
baseUrl + "/api/v1/" + getId() + "/videos?" + START_KEY + "=0&" + COUNT_KEY + "=" + ITEMS_PER_PAGE));
10398
}
10499

105100
@Override

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,9 @@ public void testAvatarUrl() throws ParsingException {
8989
assertIsSecureUrl(extractor.getAvatarUrl());
9090
}
9191

92-
@Ignore
9392
@Test
94-
public void testBannerUrl() throws ParsingException {
95-
assertIsSecureUrl(extractor.getBannerUrl());
93+
public void testBannerUrl() {
94+
assertNull(extractor.getBannerUrl());
9695
}
9796

9897
@Test

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,9 @@ public void testAvatarUrl() throws ParsingException {
104104
assertIsSecureUrl(extractor.getAvatarUrl());
105105
}
106106

107-
@Ignore
108107
@Test
109108
public void testBannerUrl() throws ParsingException {
110-
assertIsSecureUrl(extractor.getBannerUrl());
109+
assertNull(extractor.getBannerUrl());
111110
}
112111

113112
@Test

0 commit comments

Comments
 (0)