[MediaCCC] Apply changes in InfoItemExtractors

This commit is contained in:
AudricV 2022-07-30 18:39:37 +02:00
parent 2f40861428
commit 306068a63b
No known key found for this signature in database
GPG Key ID: DA92EC7905614198
4 changed files with 33 additions and 26 deletions

View File

@ -1,12 +1,17 @@
package org.schabi.newpipe.extractor.services.media_ccc.extractors; package org.schabi.newpipe.extractor.services.media_ccc.extractors;
import com.grack.nanojson.JsonObject; import com.grack.nanojson.JsonObject;
import org.schabi.newpipe.extractor.Image;
import org.schabi.newpipe.extractor.exceptions.ParsingException; import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.localization.DateWrapper; import org.schabi.newpipe.extractor.localization.DateWrapper;
import org.schabi.newpipe.extractor.stream.StreamInfoItemExtractor; import org.schabi.newpipe.extractor.stream.StreamInfoItemExtractor;
import org.schabi.newpipe.extractor.stream.StreamType; import org.schabi.newpipe.extractor.stream.StreamType;
import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.List;
import static org.schabi.newpipe.extractor.services.media_ccc.extractors.MediaCCCParsingHelper.getThumbnailsFromLiveStreamItem;
public class MediaCCCLiveStreamKioskExtractor implements StreamInfoItemExtractor { public class MediaCCCLiveStreamKioskExtractor implements StreamInfoItemExtractor {
@ -32,9 +37,10 @@ public class MediaCCCLiveStreamKioskExtractor implements StreamInfoItemExtractor
return roomInfo.getString("link"); return roomInfo.getString("link");
} }
@Nonnull
@Override @Override
public String getThumbnailUrl() throws ParsingException { public List<Image> getThumbnails() throws ParsingException {
return roomInfo.getString("thumb"); return getThumbnailsFromLiveStreamItem(roomInfo);
} }
@Override @Override
@ -75,12 +81,6 @@ public class MediaCCCLiveStreamKioskExtractor implements StreamInfoItemExtractor
return "https://media.ccc.de/c/" + conferenceInfo.getString("slug"); return "https://media.ccc.de/c/" + conferenceInfo.getString("slug");
} }
@Nullable
@Override
public String getUploaderAvatarUrl() {
return null;
}
@Override @Override
public boolean isUploaderVerified() throws ParsingException { public boolean isUploaderVerified() throws ParsingException {
return false; return false;

View File

@ -2,6 +2,7 @@ package org.schabi.newpipe.extractor.services.media_ccc.extractors;
import com.grack.nanojson.JsonObject; import com.grack.nanojson.JsonObject;
import org.schabi.newpipe.extractor.Image;
import org.schabi.newpipe.extractor.exceptions.ParsingException; import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.localization.DateWrapper; import org.schabi.newpipe.extractor.localization.DateWrapper;
import org.schabi.newpipe.extractor.services.media_ccc.linkHandler.MediaCCCConferenceLinkHandlerFactory; import org.schabi.newpipe.extractor.services.media_ccc.linkHandler.MediaCCCConferenceLinkHandlerFactory;
@ -10,9 +11,13 @@ import org.schabi.newpipe.extractor.stream.StreamType;
import java.time.ZonedDateTime; import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import static org.schabi.newpipe.extractor.services.media_ccc.extractors.MediaCCCParsingHelper.getImageListFromLogoImageUrl;
public class MediaCCCRecentKioskExtractor implements StreamInfoItemExtractor { public class MediaCCCRecentKioskExtractor implements StreamInfoItemExtractor {
private final JsonObject event; private final JsonObject event;
@ -31,9 +36,10 @@ public class MediaCCCRecentKioskExtractor implements StreamInfoItemExtractor {
return event.getString("frontend_link"); return event.getString("frontend_link");
} }
@Nonnull
@Override @Override
public String getThumbnailUrl() throws ParsingException { public List<Image> getThumbnails() throws ParsingException {
return event.getString("thumb_url"); return getImageListFromLogoImageUrl(event.getString("poster_url"));
} }
@Override @Override
@ -70,12 +76,6 @@ public class MediaCCCRecentKioskExtractor implements StreamInfoItemExtractor {
.getUrl(); // web URL .getUrl(); // web URL
} }
@Nullable
@Override
public String getUploaderAvatarUrl() {
return null;
}
@Override @Override
public boolean isUploaderVerified() throws ParsingException { public boolean isUploaderVerified() throws ParsingException {
return false; return false;

View File

@ -2,10 +2,16 @@ package org.schabi.newpipe.extractor.services.media_ccc.extractors.infoItems;
import com.grack.nanojson.JsonObject; import com.grack.nanojson.JsonObject;
import org.schabi.newpipe.extractor.Image;
import org.schabi.newpipe.extractor.ListExtractor; import org.schabi.newpipe.extractor.ListExtractor;
import org.schabi.newpipe.extractor.channel.ChannelInfoItemExtractor; import org.schabi.newpipe.extractor.channel.ChannelInfoItemExtractor;
import org.schabi.newpipe.extractor.exceptions.ParsingException; import org.schabi.newpipe.extractor.exceptions.ParsingException;
import javax.annotation.Nonnull;
import java.util.List;
import static org.schabi.newpipe.extractor.services.media_ccc.extractors.MediaCCCParsingHelper.getImageListFromLogoImageUrl;
public class MediaCCCConferenceInfoItemExtractor implements ChannelInfoItemExtractor { public class MediaCCCConferenceInfoItemExtractor implements ChannelInfoItemExtractor {
private final JsonObject conference; private final JsonObject conference;
@ -43,8 +49,9 @@ public class MediaCCCConferenceInfoItemExtractor implements ChannelInfoItemExtra
return conference.getString("url"); return conference.getString("url");
} }
@Nonnull
@Override @Override
public String getThumbnailUrl() { public List<Image> getThumbnails() {
return conference.getString("logo_url"); return getImageListFromLogoImageUrl(conference.getString("logo_url"));
} }
} }

View File

@ -1,13 +1,18 @@
package org.schabi.newpipe.extractor.services.media_ccc.extractors.infoItems; package org.schabi.newpipe.extractor.services.media_ccc.extractors.infoItems;
import com.grack.nanojson.JsonObject; import com.grack.nanojson.JsonObject;
import org.schabi.newpipe.extractor.Image;
import org.schabi.newpipe.extractor.exceptions.ParsingException; import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.localization.DateWrapper; import org.schabi.newpipe.extractor.localization.DateWrapper;
import org.schabi.newpipe.extractor.services.media_ccc.extractors.MediaCCCParsingHelper; import org.schabi.newpipe.extractor.services.media_ccc.extractors.MediaCCCParsingHelper;
import org.schabi.newpipe.extractor.stream.StreamInfoItemExtractor; import org.schabi.newpipe.extractor.stream.StreamInfoItemExtractor;
import org.schabi.newpipe.extractor.stream.StreamType; import org.schabi.newpipe.extractor.stream.StreamType;
import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.List;
import static org.schabi.newpipe.extractor.services.media_ccc.extractors.MediaCCCParsingHelper.getThumbnailsFromStreamItem;
public class MediaCCCStreamInfoItemExtractor implements StreamInfoItemExtractor { public class MediaCCCStreamInfoItemExtractor implements StreamInfoItemExtractor {
private final JsonObject event; private final JsonObject event;
@ -46,12 +51,6 @@ public class MediaCCCStreamInfoItemExtractor implements StreamInfoItemExtractor
return event.getString("conference_url"); return event.getString("conference_url");
} }
@Nullable
@Override
public String getUploaderAvatarUrl() {
return null;
}
@Override @Override
public boolean isUploaderVerified() throws ParsingException { public boolean isUploaderVerified() throws ParsingException {
return false; return false;
@ -84,8 +83,9 @@ public class MediaCCCStreamInfoItemExtractor implements StreamInfoItemExtractor
+ event.getString("guid"); + event.getString("guid");
} }
@Nonnull
@Override @Override
public String getThumbnailUrl() { public List<Image> getThumbnails() {
return event.getString("thumb_url"); return getThumbnailsFromStreamItem(event);
} }
} }