Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[media.ccc.de] Only extract kiosk live stream rooms if they are streaming #1089

Merged
merged 2 commits into from
Aug 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public KioskList getKioskList() throws ExtractionException {
kioskId
),
new MediaCCCConferencesListLinkHandlerFactory(),
"conferences"
MediaCCCConferenceKiosk.KIOSK_ID
);

list.addKioskEntry(
Expand All @@ -111,7 +111,7 @@ public KioskList getKioskList() throws ExtractionException {
kioskId
),
new MediaCCCRecentListLinkHandlerFactory(),
"recent"
MediaCCCRecentKiosk.KIOSK_ID
);

list.addKioskEntry(
Expand All @@ -121,10 +121,10 @@ public KioskList getKioskList() throws ExtractionException {
kioskId
),
new MediaCCCLiveListLinkHandlerFactory(),
"live"
MediaCCCLiveStreamKiosk.KIOSK_ID
);

list.setDefaultKiosk("recent");
list.setDefaultKiosk(MediaCCCRecentKiosk.KIOSK_ID);
} catch (final Exception e) {
throw new ExtractionException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void onFetchPage(@Nonnull final Downloader downloader)
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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
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,
Expand All @@ -36,13 +38,16 @@ public InfoItemsPage<StreamInfoItem> getInitialPage() throws IOException, Extrac
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));
}
}
}

Expand All @@ -59,6 +64,6 @@ public InfoItemsPage<StreamInfoItem> getPage(final Page page)
@Nonnull
@Override
public String getName() throws ParsingException {
return "live";
return KIOSK_ID;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

public class MediaCCCRecentKiosk extends KioskExtractor<StreamInfoItem> {

public static final String KIOSK_ID = "recent";

private JsonObject doc;

public MediaCCCRecentKiosk(final StreamingService streamingService,
Expand Down Expand Up @@ -77,6 +79,6 @@ public InfoItemsPage<StreamInfoItem> getPage(final Page page)
@Nonnull
@Override
public String getName() throws ParsingException {
return "recent";
return KIOSK_ID;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@ public KioskList getKioskList() throws ExtractionException {
id
),
new YoutubeTrendingLinkHandlerFactory(),
"Trending"
YoutubeTrendingExtractor.KIOSK_ID
);
list.setDefaultKiosk("Trending");
list.setDefaultKiosk(YoutubeTrendingExtractor.KIOSK_ID);
} catch (final Exception e) {
throw new ExtractionException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
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";
Expand Down