package org.schabi.newpipe.extractor.services.youtube.extractors; import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getTextFromObject; import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getThumbnailsFromInfoItem; import static org.schabi.newpipe.extractor.utils.Utils.isNullOrEmpty; import com.grack.nanojson.JsonObject; import org.schabi.newpipe.extractor.Image; import org.schabi.newpipe.extractor.exceptions.ParsingException; import org.schabi.newpipe.extractor.localization.DateWrapper; import org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeStreamLinkHandlerFactory; import org.schabi.newpipe.extractor.stream.StreamInfoItemExtractor; import org.schabi.newpipe.extractor.stream.StreamType; import org.schabi.newpipe.extractor.utils.Utils; import java.util.List; import javax.annotation.Nonnull; import javax.annotation.Nullable; /** * A {@link StreamInfoItemExtractor} for YouTube's {@code reelItemRenderers}. * *
* {@code reelItemRenderers} are returned on YouTube for their short-form contents on almost every * place and every major client. They provide a limited amount of information and do not provide * the exact view count, any uploader info (name, URL, avatar, verified status) and the upload date. *
*/ public class YoutubeReelInfoItemExtractor implements StreamInfoItemExtractor { @Nonnull private final JsonObject reelInfo; public YoutubeReelInfoItemExtractor(@Nonnull final JsonObject reelInfo) { this.reelInfo = reelInfo; } @Override public String getName() throws ParsingException { return getTextFromObject(reelInfo.getObject("headline")); } @Override public String getUrl() throws ParsingException { try { final String videoId = reelInfo.getString("videoId"); return YoutubeStreamLinkHandlerFactory.getInstance().getUrl(videoId); } catch (final Exception e) { throw new ParsingException("Could not get URL", e); } } @Nonnull @Override public List