Merge pull request #1089 from TeamNewPipe/ccc

[media.ccc.de] Only extract kiosk live stream rooms if they are streaming
This commit is contained in:
Stypox 2023-08-06 10:12:04 +02:00 committed by GitHub
commit 7c70fef197
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 28 additions and 16 deletions

View File

@ -101,7 +101,7 @@ public class MediaCCCService extends StreamingService {
kioskId
),
new MediaCCCConferencesListLinkHandlerFactory(),
"conferences"
MediaCCCConferenceKiosk.KIOSK_ID
);
list.addKioskEntry(
@ -111,7 +111,7 @@ public class MediaCCCService extends StreamingService {
kioskId
),
new MediaCCCRecentListLinkHandlerFactory(),
"recent"
MediaCCCRecentKiosk.KIOSK_ID
);
list.addKioskEntry(
@ -121,10 +121,10 @@ public class MediaCCCService extends StreamingService {
kioskId
),
new MediaCCCLiveListLinkHandlerFactory(),
"live"
MediaCCCLiveStreamKiosk.KIOSK_ID
);
list.setDefaultKiosk("recent");
list.setDefaultKiosk(MediaCCCRecentKiosk.KIOSK_ID);
} catch (final Exception e) {
throw new ExtractionException(e);
}

View File

@ -96,7 +96,7 @@ public class MediaCCCConferenceExtractor extends ChannelExtractor {
try {
conferenceData = JsonParser.object().from(downloader.get(conferenceUrl).responseBody());
} catch (final JsonParserException jpe) {
throw new ExtractionException("Could not parse json returnd by url: " + conferenceUrl);
throw new ExtractionException("Could not parse json returned by URL: " + conferenceUrl);
}
}

View File

@ -21,6 +21,8 @@ import java.io.IOException;
import javax.annotation.Nonnull;
public class MediaCCCConferenceKiosk extends KioskExtractor<ChannelInfoItem> {
public static final String KIOSK_ID = "conferences";
private JsonObject doc;
public MediaCCCConferenceKiosk(final StreamingService streamingService,

View File

@ -16,6 +16,8 @@ import javax.annotation.Nonnull;
import java.io.IOException;
public class MediaCCCLiveStreamKiosk extends KioskExtractor<StreamInfoItem> {
public static final String KIOSK_ID = "live";
private JsonArray doc;
public MediaCCCLiveStreamKiosk(final StreamingService streamingService,
@ -36,13 +38,16 @@ public class MediaCCCLiveStreamKiosk extends KioskExtractor<StreamInfoItem> {
final StreamInfoItemsCollector collector = new StreamInfoItemsCollector(getServiceId());
for (int c = 0; c < doc.size(); c++) {
final JsonObject conference = doc.getObject(c);
final JsonArray groups = conference.getArray("groups");
for (int g = 0; g < groups.size(); g++) {
final String group = groups.getObject(g).getString("group");
final JsonArray rooms = groups.getObject(g).getArray("rooms");
for (int r = 0; r < rooms.size(); r++) {
final JsonObject room = rooms.getObject(r);
collector.commit(new MediaCCCLiveStreamKioskExtractor(conference, group, room));
if (conference.getBoolean("isCurrentlyStreaming")) {
final JsonArray groups = conference.getArray("groups");
for (int g = 0; g < groups.size(); g++) {
final String group = groups.getObject(g).getString("group");
final JsonArray rooms = groups.getObject(g).getArray("rooms");
for (int r = 0; r < rooms.size(); r++) {
final JsonObject room = rooms.getObject(r);
collector.commit(new MediaCCCLiveStreamKioskExtractor(
conference, group, room));
}
}
}
@ -59,6 +64,6 @@ public class MediaCCCLiveStreamKiosk extends KioskExtractor<StreamInfoItem> {
@Nonnull
@Override
public String getName() throws ParsingException {
return "live";
return KIOSK_ID;
}
}

View File

@ -23,6 +23,8 @@ import javax.annotation.Nonnull;
public class MediaCCCRecentKiosk extends KioskExtractor<StreamInfoItem> {
public static final String KIOSK_ID = "recent";
private JsonObject doc;
public MediaCCCRecentKiosk(final StreamingService streamingService,
@ -77,6 +79,6 @@ public class MediaCCCRecentKiosk extends KioskExtractor<StreamInfoItem> {
@Nonnull
@Override
public String getName() throws ParsingException {
return "recent";
return KIOSK_ID;
}
}

View File

@ -146,9 +146,9 @@ public class YoutubeService extends StreamingService {
id
),
new YoutubeTrendingLinkHandlerFactory(),
"Trending"
YoutubeTrendingExtractor.KIOSK_ID
);
list.setDefaultKiosk("Trending");
list.setDefaultKiosk(YoutubeTrendingExtractor.KIOSK_ID);
} catch (final Exception e) {
throw new ExtractionException(e);
}

View File

@ -46,6 +46,9 @@ import java.util.stream.Stream;
import javax.annotation.Nonnull;
public class YoutubeTrendingExtractor extends KioskExtractor<StreamInfoItem> {
public static final String KIOSK_ID = "Trending";
private JsonObject initialData;
private static final String VIDEOS_TAB_PARAMS = "4gIOGgxtb3N0X3BvcHVsYXI%3D";