package rasel.lunar.launcher.model.others

import org.json.JSONObject
import rasel.lunar.launcher.model.RssDataInterface
import rasel.lunar.launcher.model.RssDataType
import rasel.lunar.launcher.utils.JamoUtils
import rasel.lunar.launcher.utils.afterDay
import rasel.lunar.launcher.utils.beforeDay
import java.util.Date


// import com.fasterxml.jackson.databind.ObjectMapper; // version 2.11.1
// import com.fasterxml.jackson.annotation.JsonProperty; // version 2.11.1
/* ObjectMapper om = new ObjectMapper();
Root root = om.readValue(myJsonString, Root.class); */
class A11ySkipNavigationButton {
    var buttonRenderer: ButtonRenderer? = null
}

class Accessibility {
    var accessibilityData: AccessibilityData? = null
    var label: String? = null
}

class AccessibilityContext {
    var label: String? = null
}

class AccessibilityData {
    var label: String? = null
    var accessibilityData: AccessibilityData? = null
    var publishedTimeText : PublishedTimeText? = null
}

class Action {
    var clickTrackingParams: String? = null
    var addToPlaylistCommand: AddToPlaylistCommand? = null
    var action: String? = null
    var removedVideoId: String? = null
    var openPopupAction: OpenPopupAction? = null
    var subscribeButtonViewModel: SubscribeButtonViewModel? = null
    var buttonViewModel: ButtonViewModel? = null
    var signalAction: SignalAction? = null
    var addedVideoId: String? = null
    var flexibleActionsViewModel: FlexibleActionsViewModel? = null
}

class ActionsRow {
    var actions: ArrayList<Action>? = null
}

class AdditionalData {
    var userFeedbackEndpointProductSpecificValueData: UserFeedbackEndpointProductSpecificValueData? =
        null
}

class AddToPlaylistCommand {
    var openMiniplayer: Boolean = false
    var videoId: String? = null
    var listType: String? = null
    var onCreateListCommand: OnCreateListCommand? = null
    var videoIds: ArrayList<String>? = null
}

class AddToPlaylistServiceEndpoint {
    var videoId: String? = null
}

class AttachmentRun {
    var startIndex: Int = 0
    var length: Int = 0
    var element: Element? = null
    var alignment: String? = null
}

class Attribution {
    var attributionViewModel: AttributionViewModel? = null
}

class AttributionViewModel {
    var text: Text? = null
    var suffix: Suffix? = null
    var rendererContext: RendererContext? = null
}

class Avatar {
    var decoratedAvatarViewModel: DecoratedAvatarViewModel? = null
    var avatarViewModel: AvatarViewModel? = null
    var thumbnails: ArrayList<Thumbnail>? = null
    var accessibility: Accessibility? = null
}

class AvatarViewModel {
    var YTBImage: YTBImage? = null
    var avatarImageSize: String? = null
    var loggingDirectives: LoggingDirectives? = null
}

class BackButton {
    var buttonRenderer: ButtonRenderer? = null
}

class Badge {
    var metadataBadgeRenderer: MetadataBadgeRenderer? = null
}

class Banner {
    var imageBannerViewModel: ImageBannerViewModel? = null
}

class BellAccessibilityData {
    var offLabel: String? = null
    var allLabel: String? = null
    var occasionalLabel: String? = null
    var disabledLabel: String? = null
}

class BorderImageProcessor {
    var circular: Boolean = false
}

class BrowseEndpoint {
    var browseId: String? = null
    var params: String? = null
    var canonicalBaseUrl: String? = null
}

class Button {
    var menuRenderer: MenuRenderer? = null
}

class ButtonRenderer {
    var style: String? = null
    var size: String? = null
    var isDisabled: Boolean = false
    var icon: Icon? = null
    var accessibility: Accessibility? = null
    var trackingParams: String? = null
    var accessibilityData: AccessibilityData? = null
    var command: Command? = null
    var text: Text? = null
    var serviceEndpoint: ServiceEndpoint? = null
    var tooltip: String? = null
    var navigationEndpoint: NavigationEndpoint? = null
}

class ButtonStyle {
    var unsubscribedStateStyle: String? = null
    var subscribedStateStyle: String? = null
    var buttonSize: String? = null
}

class ButtonText {
    var runs: ArrayList<Run>? = null
}

class ButtonViewModel {
    var title: String? = null
    var onTap: OnTap? = null
    var accessibilityText: String? = null
    var style: String? = null
    var trackingParams: String? = null
    var isFullWidth: Boolean = false
    var type: String? = null
    var buttonSize: String? = null
    var state: String? = null
    var onVisible: OnVisible? = null
    var targetId: String? = null
    var loggingDirectives: LoggingDirectives? = null
}

class CancelButton {
    var buttonRenderer: ButtonRenderer? = null
}

class ChangeEngagementPanelVisibilityAction {
    var targetId: String? = null
    var visibility: String? = null
}

class ChannelFeaturedContentRenderer {
    var title: Title? = null
    var items: ArrayList<Item>? = null
}

class ChannelMetadataRenderer {
    var title: String? = null
    var description: String? = null
    var rssUrl: String? = null
    var channelConversionUrl: String? = null
    var externalId: String? = null
    var keywords: String? = null
    var ownerUrls: ArrayList<String>? = null
    var avatar: Avatar? = null
    var channelUrl: String? = null
    var isFamilySafe: Boolean = false
    var availableCountryCodes: ArrayList<String>? = null
    var androidDeepLink: String? = null
    var androidAppindexingLink: String? = null
    var iosAppindexingLink: String? = null
    var vanityChannelUrl: String? = null
}

class ChannelThumbnailSupportedRenderers {
    var channelThumbnailWithLinkRenderer: ChannelThumbnailWithLinkRenderer? = null
}

class ChannelThumbnailWithLinkRenderer {
    var thumbnail: Thumbnail? = null
    var navigationEndpoint: NavigationEndpoint? = null
    var accessibility: Accessibility? = null
}

class ClearButton {
    var buttonRenderer: ButtonRenderer? = null
}

class ClientResource {
    var imageName: String? = null
}

class ClientVeSpec {
    var uiType: Int = 0
    var veCounter: Int = 0
}

class ColorMap {
    var key: String? = null
    var value: Any? = null
}

class Command {
    var clickTrackingParams: String? = null
    var openPopupAction: OpenPopupAction? = null
    var commandMetadata: CommandMetadata? = null
    var ypcGetOffersEndpoint: YpcGetOffersEndpoint? = null
    var logFlowLoggingEventCommand: LogFlowLoggingEventCommand? = null
}

class Command10 {
    var clickTrackingParams: String? = null
    var commandMetadata: CommandMetadata? = null
    var signalServiceEndpoint: SignalServiceEndpoint? = null
    var changeEngagementPanelVisibilityAction: ChangeEngagementPanelVisibilityAction? = null
}

class CommandContext {
    var onTap: OnTap? = null
}

class CommandExecutorCommand {
    var commands: ArrayList<Command>? = null
}

class CommandMetadata {
    var webCommandMetadata: WebCommandMetadata? = null
}

class CommandRun {
    var startIndex: Int = 0
    var length: Int = 0
    var onTap: OnTap? = null
}

class CommonConfig {
    var url: String? = null
}

class CompactLinkRenderer {
    var icon: Icon? = null
    var title: Title? = null
    var navigationEndpoint: NavigationEndpoint? = null
    var trackingParams: String? = null
    var style: String? = null
}

class Config {
    var webSearchboxConfig: WebSearchboxConfig? = null
}

class ConfirmButton {
    var buttonRenderer: ButtonRenderer? = null
}

class ConfirmDialogRenderer {
    var trackingParams: String? = null
    var dialogMessages: ArrayList<DialogMessage>? = null
    var confirmButton: ConfirmButton? = null
    var cancelButton: CancelButton? = null
    var primaryIsCancel: Boolean = false
}

class ConnectionErrorHeader {
    var runs: ArrayList<Run>? = null
}

class ConnectionErrorMicrophoneLabel {
    var runs: ArrayList<Run>? = null
}

class Content : Content14() {
    var sectionListRenderer: SectionListRenderer? = null
    var horizontalListRenderer: HorizontalListRenderer? = null
    var pageHeaderViewModel: PageHeaderViewModel? = null
    var verticalListRenderer: HorizontalListRenderer? = null
    var listViewModel: ListViewModel? = null
}

open class Content14 {
    var itemSectionRenderer: ItemSectionRenderer? = null
    var continuationItemRenderer: ContinuationItemRenderer? = null
    var channelFeaturedContentRenderer: ChannelFeaturedContentRenderer? = null
    var shelfRenderer: ShelfRenderer? = null
    var reelShelfRenderer: ReelShelfRenderer? = null
    var twoColumnBrowseResultsRenderer: TwoColumnBrowseResultsRenderer? = null
    var singleColumnBrowseResultsRenderer : TwoColumnBrowseResultsRenderer? = null
}

class ContentMetadataViewModel {
    var metadataRows: ArrayList<MetadataRow>? = null
    var delimiter: String? = null
    var rendererContext: RendererContext? = null
}

class ContinuationCommand {
    var token: String? = null
    var request: String? = null
}

class ContinuationEndpoint {
    var clickTrackingParams: String? = null
    var commandMetadata: CommandMetadata? = null
    var continuationCommand: ContinuationCommand? = null
}

class ContinuationItemRenderer {
    var trigger: String? = null
    var continuationEndpoint: ContinuationEndpoint? = null
}

class CreatePlaylistServiceEndpoint {
    var videoIds: ArrayList<String>? = null
    var params: String? = null
}

class DecoratedAvatarViewModel {
    var avatar: Avatar? = null
    var a11yLabel: String? = null
    var rendererContext: RendererContext? = null
}

class Description {
    var descriptionPreviewViewModel: DescriptionPreviewViewModel? = null
    var content: String? = null
}

class DescriptionPreviewViewModel {
    var description: Description? = null
    var maxLines: Int = 0
    var truncationText: TruncationText? = null
    var alwaysShowTruncationText: Boolean = false
    var rendererContext: RendererContext? = null
}

class DescriptionSnippet {
    var runs: ArrayList<Run>? = null
}

class DesktopTopbarRenderer {
    var logo: Logo? = null
    var searchbox: Searchbox? = null
    var trackingParams: String? = null
    var countryCode: String? = null
    var topbarButtons: ArrayList<TopbarButton>? = null
    var hotkeyDialog: HotkeyDialog? = null
    var backButton: BackButton? = null
    var forwardButton: ForwardButton? = null
    var a11ySkipNavigationButton: A11ySkipNavigationButton? = null
    var voiceSearchButton: VoiceSearchButton? = null
}

class DialogMessage {
    var runs: ArrayList<Run>? = null
}

class DisabledHeader {
    var runs: ArrayList<Run>? = null
}

class DisabledSubtext {
    var runs: ArrayList<Run>? = null
}

class DismissButton {
    var buttonRenderer: ButtonRenderer? = null
}

class DynamicTextViewModel {
    var text: Text? = null
    var maxLines: Int = 0
    var rendererContext: RendererContext? = null
}

class Element {
    var type: Type? = null
    var properties: Properties? = null
}

class Endpoint {
    var clickTrackingParams: String? = null
    var commandMetadata: CommandMetadata? = null
    var browseEndpoint: BrowseEndpoint? = null
    var showEngagementPanelEndpoint: ShowEngagementPanelEndpoint? = null
}

class EngagementPanel {
    var engagementPanelSectionListRenderer: EngagementPanelSectionListRenderer? = null
}

class EngagementPanelPopupPresentationConfig {
    var popupType: String? = null
}

class EngagementPanelPresentationConfigs {
    var engagementPanelPopupPresentationConfig: EngagementPanelPopupPresentationConfig? = null
}

class EngagementPanelSectionListRenderer {
    var header: Header? = null
    var content: Content? = null
    var targetId: String? = null
    var identifier: Identifier? = null
    var size: String? = null
}

class EngagementPanelTitleHeaderRenderer {
    var title: Title? = null
    var visibilityButton: VisibilityButton? = null
    var trackingParams: String? = null
}

class EntityBatchUpdate {
    var mutations: ArrayList<Mutation>? = null
    var timestamp: Timestamp? = null
}

class ExampleQuery1 {
    var runs: ArrayList<Run>? = null
}

class ExampleQuery2 {
    var runs: ArrayList<Run>? = null
}

class ExitButton {
    var buttonRenderer: ButtonRenderer? = null
}

class ExpandableTabRenderer {
    var endpoint: Endpoint? = null
    var title: String? = null
    var selected: Boolean = false
}

class FlexibleActionsViewModel {
    var actionsRows: ArrayList<ActionsRow>? = null
    var minimumRowHeight: Int = 0
    var rendererContext: RendererContext? = null
}

class FlowEventMetadata {
    var sponsorshipsPurchaseContext: SponsorshipsPurchaseContext? = null
}

class ForwardButton {
    var buttonRenderer: ButtonRenderer? = null
}

class FrameworkUpdates {
    var entityBatchUpdate: EntityBatchUpdate? = null
}

class FusionSearchboxRenderer {
    var icon: Icon? = null
    var placeholderText: PlaceholderText? = null
    var config: Config? = null
    var trackingParams: String? = null
    var searchEndpoint: SearchEndpoint? = null
    var clearButton: ClearButton? = null
}

class GetDownloadActionCommand {
    var videoId: String? = null
    var params: String? = null
}

class GridChannelRenderer {
    var channelId: String? = null
    var thumbnail: Thumbnail? = null
    var videoCountText: VideoCountText? = null
    var subscriberCountText: SubscriberCountText? = null
    var navigationEndpoint: NavigationEndpoint? = null
    var title: Title? = null
    var subscribeButton: SubscribeButton? = null
    var trackingParams: String? = null
}

class GridVideoRenderer : VideoRenderer() {
    //    var videoId: String? = null
//    var thumbnail: Thumbnail? = null
//    var title: Title? = null
//    var publishedTimeText: PublishedTimeText? = null
//    var navigationEndpoint: NavigationEndpoint? = null
    var badges: ArrayList<Badge>? = null
    //    var ownerBadges: ArrayList<OwnerBadge>? = null
//    var trackingParams: String? = null
//    var menu: Menu? = null
//    var thumbnailOverlays: ArrayList<ThumbnailOverlay>? = null
//    var viewCountText: ViewCountText? = null
//    var shortViewCountText: ShortViewCountText? = null
    var richThumbnail: RichThumbnail? = null
//    var shortBylineText: ShortBylineText? = null
}

class Header {
    var engagementPanelTitleHeaderRenderer: EngagementPanelTitleHeaderRenderer? = null
    var pageHeaderRenderer: PageHeaderRenderer? = null
}

class Headline {
    var simpleText: String? = null
}

class Height {
    var value: Int = 0
    var unit: String? = null
}

class HorizontalListRenderer {
    var items: ArrayList<Item>? = null
    var trackingParams: String? = null
    var visibleItemCount: Int = 0
    var nextButton: NextButton? = null
    var previousButton: PreviousButton? = null
    var collapsedItemCount: Int = 0
    var itemSizeConstraint: String? = null
}

class HotkeyAccessibilityLabel {
    var accessibilityData: AccessibilityData? = null
}

class HotkeyDialog {
    var hotkeyDialogRenderer: HotkeyDialogRenderer? = null
}

class HotkeyDialogRenderer {
    var title: Title? = null
    var sections: ArrayList<Section>? = null
    var dismissButton: DismissButton? = null
    var trackingParams: String? = null
}

class HotkeyDialogSectionOptionRenderer {
    var label: Label? = null
    var hotkey: String? = null
    var hotkeyAccessibilityLabel: HotkeyAccessibilityLabel? = null
}

class HotkeyDialogSectionRenderer {
    var title: Title? = null
    var options: ArrayList<Option>? = null
}

class Html5PlaybackOnesieConfig {
    var commonConfig: CommonConfig? = null
}

class Icon {
    var iconType: String? = null
}

class IconImage {
    var iconType: String? = null
}

class Identifier {
    var surface: String? = null
    var tag: String? = null
}

class YTBImage {
    var sources: ArrayList<YTBSource>? = null
    var decoratedAvatarViewModel: DecoratedAvatarViewModel? = null
    var processor: Processor? = null
}

class ImageBannerViewModel {
    var YTBImage: YTBImage? = null
    var style: String? = null
    var rendererContext: RendererContext? = null
}

class ImageType {
    var YTBImage: YTBImage? = null
}

class InlineContent {
    var sheetViewModel: SheetViewModel? = null
}

class InnertubeCommand {
    var clickTrackingParams: String? = null
    var commandMetadata: CommandMetadata? = null
    var browseEndpoint: BrowseEndpoint? = null
    var showEngagementPanelEndpoint: ShowEngagementPanelEndpoint? = null
    var subscribeEndpoint: SubscribeEndpoint? = null
    var signalServiceEndpoint: SignalServiceEndpoint? = null
    var showSheetCommand: ShowSheetCommand? = null
    var modifyChannelNotificationPreferenceEndpoint: ModifyChannelNotificationPreferenceEndpoint? =
        null
    var commandExecutorCommand: CommandExecutorCommand? = null
    var logFlowLoggingEventCommand: LogFlowLoggingEventCommand? = null
    var urlEndpoint: UrlEndpoint? = null
}

class Item {
    var videoRenderer: VideoRenderer? = null
    var menuServiceItemRenderer: MenuServiceItemRenderer? = null
    var menuServiceItemDownloadRenderer: MenuServiceItemDownloadRenderer? = null
    var gridVideoRenderer: GridVideoRenderer? = null
    var gridChannelRenderer: GridChannelRenderer? = null
    var menuNavigationItemRenderer: MenuNavigationItemRenderer? = null
    var reelItemRenderer: ReelItemRenderer? = null
    var compactLinkRenderer: CompactLinkRenderer? = null
    var compactVideoRenderer : VideoRenderer? = null
}

class ItemSectionRenderer {
    var contents: ArrayList<Content14>? = null
    var trackingParams: String? = null
    var sectionIdentifier: String? = null
    var targetId: String? = null
}

class Label {
    var runs: ArrayList<Run>? = null
}

class LayoutProperties {
    var height: Height? = null
    var width: Width? = null
    var margin: Margin? = null
}

class LeadingImage {
    var sources: ArrayList<YTBSource>? = null
}

class Left {
    var value: Int = 0
    var unit: String? = null
}

class LengthText {
    var accessibility: Accessibility? = null
    var simpleText: String? = null
}

class LinkAlternate {
    var hrefUrl: String? = null
}

class ListItem {
    var listItemViewModel: ListItemViewModel? = null
}

class ListItemViewModel {
    var title: Title? = null
    var leadingImage: LeadingImage? = null
    var isDisabled: Boolean = false
    var isSelected: Boolean = false
    var selectionStyle: String? = null
    var rendererContext: RendererContext? = null
}

class ListViewModel {
    var listItems: ArrayList<ListItem>? = null
}

class LoadingHeader {
    var runs: ArrayList<Run>? = null
}

class LogFlowLoggingEventCommand {
    var flowEventType: Int = 0
    var flowEventNamespace: String? = null
    var flowType: String? = null
    var flowEventMetadata: FlowEventMetadata? = null
}

class LoggingContext {
    var vssLoggingContext: VssLoggingContext? = null
    var loggingDirectives: LoggingDirectives? = null
    var qoeLoggingContext: QoeLoggingContext? = null
}

class LoggingDirectives {
    var trackingParams: String? = null
    var visibility: Visibility? = null
    var enableDisplayloggerExperiment: Boolean = false
    var clientVeSpec: ClientVeSpec? = null
}

class Logo {
    var topbarLogoRenderer: TopbarLogoRenderer? = null
}

class LongBylineText {
    var runs: ArrayList<Run>? = null
}

class MainAppWebResponseContext {
    var datasyncId: String? = null
    var loggedOut: Boolean = false
    var trackingParam: String? = null
}

class Margin {
    var left: Left? = null
}

class Menu {
    var menuRenderer: MenuRenderer? = null
}

class MenuNavigationItemRenderer {
    var text: Text? = null
    var icon: Icon? = null
    var navigationEndpoint: NavigationEndpoint? = null
    var trackingParams: String? = null
    var accessibility: Accessibility? = null
}

class MenuRenderer {
    var items: ArrayList<Item>? = null
    var trackingParams: String? = null
    var accessibility: Accessibility? = null
    var multiPageMenuRenderer: MultiPageMenuRenderer? = null
}

class MenuRequest {
    var clickTrackingParams: String? = null
    var commandMetadata: CommandMetadata? = null
    var signalServiceEndpoint: SignalServiceEndpoint? = null
}

class MenuServiceItemDownloadRenderer {
    var serviceEndpoint: ServiceEndpoint? = null
    var trackingParams: String? = null
}

class MenuServiceItemRenderer {
    var text: Text? = null
    var icon: Icon? = null
    var serviceEndpoint: ServiceEndpoint? = null
    var trackingParams: String? = null
    var hasSeparator: Boolean = false
}

class Metadata {
    var contentMetadataViewModel: ContentMetadataViewModel? = null
    var channelMetadataRenderer: ChannelMetadataRenderer? = null
}

class MetadataBadgeRenderer {
    var icon: Icon? = null
    var style: String? = null
    var tooltip: String? = null
    var trackingParams: String? = null
    var accessibilityData: AccessibilityData? = null
    var label: String? = null
    var iconSourceUrl: String? = null
}

class MetadataPart {
    var text: Text? = null
    var enableTruncation: Boolean = false
}

class MetadataRow {
    var metadataParts: ArrayList<MetadataPart>? = null
}

class Microformat {
    var microformatDataRenderer: MicroformatDataRenderer? = null
}

class MicroformatDataRenderer {
    var urlCanonical: String? = null
    var title: String? = null
    var description: String? = null
    var thumbnail: Thumbnail? = null
    var siteName: String? = null
    var appName: String? = null
    var androidPackage: String? = null
    var iosAppStoreId: String? = null
    var iosAppArguments: String? = null
    var ogType: String? = null
    var urlApplinksWeb: String? = null
    var urlApplinksIos: String? = null
    var urlApplinksAndroid: String? = null
    var urlTwitterIos: String? = null
    var urlTwitterAndroid: String? = null
    var twitterCardType: String? = null
    var twitterSiteHandle: String? = null
    var schemaDotOrgType: String? = null
    var noindex: Boolean = false
    var unlisted: Boolean = false
    var familySafe: Boolean = false
    var tags: ArrayList<String>? = null
    var availableCountries: ArrayList<String>? = null
    var linkAlternates: ArrayList<LinkAlternate>? = null
}

class MicrophoneButtonAriaLabel {
    var runs: ArrayList<Run>? = null
}

class MicrophoneOffPromptHeader {
    var runs: ArrayList<Run>? = null
}

class ModifyChannelNotificationPreferenceEndpoint {
    var params: String? = null
}

class MovingThumbnailDetails {
    var thumbnails: ArrayList<Thumbnail>? = null
    var logAsMovingThumbnail: Boolean = false
}

class MovingThumbnailRenderer {
    var movingThumbnailDetails: MovingThumbnailDetails? = null
    var enableHoveredLogging: Boolean = false
    var enableOverlay: Boolean = false
}

class MultiPageMenuRenderer {
    var sections: ArrayList<Section>? = null
    var trackingParams: String? = null
    var style: String? = null
    var showLoadingSpinner: Boolean = false
}

class MultiPageMenuSectionRenderer {
    var items: ArrayList<Item>? = null
    var trackingParams: String? = null
}

class Mutation {
    var entityKey: String? = null
    var type: String? = null
    var payload: Payload? = null
}

class NavigationEndpoint {
    var clickTrackingParams: String? = null
    var commandMetadata: CommandMetadata? = null
    var browseEndpoint: BrowseEndpoint? = null
    var watchEndpoint: WatchEndpoint? = null
    var userFeedbackEndpoint: UserFeedbackEndpoint? = null
    var reelWatchEndpoint: ReelWatchEndpoint? = null
    var uploadEndpoint: UploadEndpoint? = null
    var signalNavigationEndpoint: SignalNavigationEndpoint? = null
    var showEngagementPanelEndpoint: ShowEngagementPanelEndpoint? = null
}

class NextButton {
    var buttonRenderer: ButtonRenderer? = null
}

class NotificationStateEntityStoreKeys {
    var subsNotificationStateKey: String? = null
}

class NotificationTopbarButtonRenderer {
    var icon: Icon? = null
    var menuRequest: MenuRequest? = null
    var style: String? = null
    var trackingParams: String? = null
    var accessibility: Accessibility? = null
    var tooltip: String? = null
    var updateUnseenCountEndpoint: UpdateUnseenCountEndpoint? = null
    var notificationCount: Int = 0
    var handlerDatas: ArrayList<String>? = null
}

class OfflineVideoEndpoint {
    var videoId: String? = null
    var onAddCommand: OnAddCommand? = null
}

class OnAddCommand {
    var clickTrackingParams: String? = null
    var getDownloadActionCommand: GetDownloadActionCommand? = null
}

class OnCreateListCommand {
    var clickTrackingParams: String? = null
    var commandMetadata: CommandMetadata? = null
    var createPlaylistServiceEndpoint: CreatePlaylistServiceEndpoint? = null
}

class OnResponseReceivedAction {
    var clickTrackingParams: String? = null
    var resetChannelUnreadCountCommand: ResetChannelUnreadCountCommand? = null
}

class OnShowSubscriptionOptions {
    var innertubeCommand: InnertubeCommand? = null
}

class OnSubscribeEndpoint {
    var clickTrackingParams: String? = null
    var commandMetadata: CommandMetadata? = null
    var subscribeEndpoint: SubscribeEndpoint? = null
}

class OnTap {
    var innertubeCommand: InnertubeCommand? = null
}

class OnTapCommand {
    var innertubeCommand: InnertubeCommand? = null
}

class OnUnsubscribeEndpoint {
    var clickTrackingParams: String? = null
    var commandMetadata: CommandMetadata? = null
    var signalServiceEndpoint: SignalServiceEndpoint? = null
}

class OnVisible {
    var innertubeCommand: InnertubeCommand? = null
}

class OpenPopupAction {
    var popup: Popup? = null
    var popupType: String? = null
    var beReused: Boolean = false
}

class Option {
    var hotkeyDialogSectionOptionRenderer: HotkeyDialogSectionOptionRenderer? = null
}

class Overlay {
    var reelPlayerOverlayRenderer: ReelPlayerOverlayRenderer? = null
}

class OwnerBadge {
    var metadataBadgeRenderer: MetadataBadgeRenderer? = null
}

class OwnerText {
    var runs: ArrayList<Run>? = null
}

class PageHeaderRenderer {
    var pageTitle: String? = null
    var content: Content? = null
}

class PageHeaderViewModel {
    var title: Title? = null
    var YTBImage: YTBImage? = null
    var metadata: Metadata? = null
    var actions: Action? = null
    var description: Description? = null
    var attribution: Attribution? = null
    var banner: Banner? = null
    var rendererContext: RendererContext? = null
}

class PanelLoadingStrategy {
    var inlineContent: InlineContent? = null
}

class Param {
    var key: String? = null
    var value: String? = null
}

class Payload {
    var subscriptionStateEntity: SubscriptionStateEntity? = null
    var subscriptionNotificationStateEntity: SubscriptionNotificationStateEntity? = null
}

class PermissionsHeader {
    var runs: ArrayList<Run>? = null
}

class PermissionsSubtext {
    var runs: ArrayList<Run>? = null
}

class PlaceholderHeader {
    var runs: ArrayList<Run>? = null
}

class PlaceholderText {
    var runs: ArrayList<Run>? = null
}

class PlayAllButton {
    var buttonRenderer: ButtonRenderer? = null
}

class PlaylistEditEndpoint {
    var playlistId: String? = null
    var actions: ArrayList<Action>? = null
}

class Popup {
    var unifiedSharePanelRenderer: UnifiedSharePanelRenderer? = null
    var confirmDialogRenderer: ConfirmDialogRenderer? = null
    var multiPageMenuRenderer: MultiPageMenuRenderer? = null
    var voiceSearchDialogRenderer: VoiceSearchDialogRenderer? = null
}

class PreviousButton {
    var buttonRenderer: ButtonRenderer? = null
}

class Processor {
    var borderImageProcessor: BorderImageProcessor? = null
}

class PromptHeader {
    var runs: ArrayList<Run>? = null
}

class PromptMicrophoneLabel {
    var runs: ArrayList<Run>? = null
}

class Properties {
    var layoutProperties: LayoutProperties? = null
}

class PublishedTimeText {
    var simpleText: String? = null
    var runs : ArrayList<Run>? = null
}

class QoeLoggingContext {
    var serializedContextData: String? = null
}

class ReelItemRenderer {
    var videoId: String? = null
    var headline: Headline? = null
    var thumbnail: Thumbnail? = null
    var viewCountText: ViewCountText? = null
    var navigationEndpoint: NavigationEndpoint? = null
    var menu: Menu? = null
    var trackingParams: String? = null
    var accessibility: Accessibility? = null
    var style: String? = null
    var videoType: String? = null
    var loggingDirectives: LoggingDirectives? = null
}

class ReelPlayerOverlayRenderer {
    var style: String? = null
    var trackingParams: String? = null
    var reelPlayerNavigationModel: String? = null
}

class ReelShelfRenderer {
    var title: Title? = null
    var button: Button? = null
    var items: ArrayList<Item>? = null
    var trackingParams: String? = null
    var icon: Icon? = null
}

class ReelWatchEndpoint {
    var videoId: String? = null
    var playerParams: String? = null
    var thumbnail: Thumbnail? = null
    var overlay: Overlay? = null
    var params: String? = null
    var sequenceProvider: String? = null
    var sequenceParams: String? = null
    var loggingContext: LoggingContext? = null
    var ustreamerConfig: String? = null
}

class RendererContext {
    var commandContext: CommandContext? = null
    var loggingContext: LoggingContext? = null
    var accessibilityContext: AccessibilityContext? = null
}

class ResetChannelUnreadCountCommand {
    var channelId: String? = null
}

class ResponseContext {
    var serviceTrackingParams: ArrayList<ServiceTrackingParam>? = null
    var maxAgeSeconds: Int = 0
    var mainAppWebResponseContext: MainAppWebResponseContext? = null
    var webResponseContextExtensionData: WebResponseContextExtensionData? = null
}

class RichThumbnail {
    var movingThumbnailRenderer: MovingThumbnailRenderer? = null
}

class Youtube {
    //    var responseContext: ResponseContext? = null
    var contents: Content14? = null
    var header: Header? = null
    var metadata: Metadata? = null
    //    var trackingParams: String? = null
//    var topbar: Topbar? = null
    var microformat: Microformat? = null
//    var onResponseReceivedActions: ArrayList<OnResponseReceivedAction>? = null
//    var frameworkUpdates: FrameworkUpdates? = null
}

class Run {
    var text: String? = null
    var navigationEndpoint: NavigationEndpoint? = null
}

class ScrollPaneStyle {
    var scrollable: Boolean = false
}

class Searchbox {
    var fusionSearchboxRenderer: FusionSearchboxRenderer? = null
}

class SearchEndpoint {
    var clickTrackingParams: String? = null
    var commandMetadata: CommandMetadata? = null
    var searchEndpoint: SearchEndpoint? = null
    var query: String? = null
}

class Section {
    var multiPageMenuSectionRenderer: MultiPageMenuSectionRenderer? = null
    var hotkeyDialogSectionRenderer: HotkeyDialogSectionRenderer? = null
}

class SectionListRenderer {
    var contents: ArrayList<Content14>? = null
    var trackingParams: String? = null
    var targetId: String? = null
    var disablePullToRefresh: Boolean = false
    var scrollPaneStyle: ScrollPaneStyle? = null
}

class ServiceEndpoint {
    var clickTrackingParams: String? = null
    var commandMetadata: CommandMetadata? = null
    var signalServiceEndpoint: SignalServiceEndpoint? = null
    var playlistEditEndpoint: PlaylistEditEndpoint? = null
    var addToPlaylistServiceEndpoint: AddToPlaylistServiceEndpoint? = null
    var shareEntityServiceEndpoint: ShareEntityServiceEndpoint? = null
    var offlineVideoEndpoint: OfflineVideoEndpoint? = null
    var unsubscribeEndpoint: UnsubscribeEndpoint? = null
}

class ServiceTrackingParam {
    var service: String? = null
    var params: ArrayList<Param>? = null
}

class ShareEntityServiceEndpoint {
    var serializedShareEntity: String? = null
    var commands: ArrayList<Command>? = null
}

class SheetViewModel {
    var content: Content? = null
}

class ShelfRenderer {
    var title: Title? = null
    var endpoint: Endpoint? = null
    var content: Content? = null
    var subtitle: Subtitle? = null
    var trackingParams: String? = null
    var playAllButton: PlayAllButton? = null
}

class ShortBylineText {
    var runs: ArrayList<Run>? = null
}

class ShortViewCountText {
    var accessibility: Accessibility? = null
    var simpleText: String? = null
}

class ShowEngagementPanelEndpoint {
    var engagementPanel: EngagementPanel? = null
    var identifier: Identifier? = null
    var engagementPanelPresentationConfigs: EngagementPanelPresentationConfigs? = null
}

class ShowSheetCommand {
    var panelLoadingStrategy: PanelLoadingStrategy? = null
}

class SignalAction {
    var signal: String? = null
}

class SignalNavigationEndpoint {
    var signal: String? = null
}

class SignalServiceEndpoint {
    var signal: String? = null
    var actions: ArrayList<Action>? = null
}

class YTBSource {
    var url: String? = null
    var width: Int = 0
    var height: Int = 0
    var clientResource: ClientResource? = null
}

class SponsorshipsPurchaseContext {
    var joinMethod: String? = null
}

class Style {
    var styleType: String? = null
}

class StyleRun {
    var startIndex: Int = 0
    var styleRunExtensions: StyleRunExtensions? = null
    var length: Int = 0
    var weight: Int = 0
    var weightLabel: String? = null
    var fontName: String? = null
    var fontSize: Int = 0
}

class StyleRunColorMapExtension {
    var colorMap: ArrayList<ColorMap>? = null
}

class StyleRunExtensions {
    var styleRunColorMapExtension: StyleRunColorMapExtension? = null
}

class SubscribeAccessibility {
    var accessibilityData: AccessibilityData? = null
}

class SubscribeButton {
    var subscribeButtonRenderer: SubscribeButtonRenderer? = null
}

class SubscribeButtonContent {
    var buttonText: String? = null
    var accessibilityText: String? = null
    var imageName: String? = null
    var subscribeState: SubscribeState? = null
    var onTapCommand: OnTapCommand? = null
}

class SubscribeButtonRenderer {
    var buttonText: ButtonText? = null
    var subscribed: Boolean = false
    var enabled: Boolean = false
    var type: String? = null
    var channelId: String? = null
    var showPreferences: Boolean = false
    var subscribedButtonText: SubscribedButtonText? = null
    var unsubscribedButtonText: UnsubscribedButtonText? = null
    var trackingParams: String? = null
    var unsubscribeButtonText: UnsubscribeButtonText? = null
    var style: Style? = null
    var subscribeAccessibility: SubscribeAccessibility? = null
    var unsubscribeAccessibility: UnsubscribeAccessibility? = null
    var subscribedEntityKey: String? = null
    var onSubscribeEndpoints: ArrayList<OnSubscribeEndpoint>? = null
    var onUnsubscribeEndpoints: ArrayList<OnUnsubscribeEndpoint>? = null
}

class SubscribeButtonViewModel {
    var subscribeButtonContent: SubscribeButtonContent? = null
    var unsubscribeButtonContent: UnsubscribeButtonContent? = null
    var stateEntityStoreKey: String? = null
    var trackingParams: String? = null
    var disableNotificationBell: Boolean = false
    var buttonStyle: ButtonStyle? = null
    var backgroundStyle: String? = null
    var disableSubscribeButton: Boolean = false
    var onShowSubscriptionOptions: OnShowSubscriptionOptions? = null
    var channelId: String? = null
    var enableSubscribeButtonPostClickAnimation: Boolean = false
    var notificationStateEntityStoreKeys: NotificationStateEntityStoreKeys? = null
    var bellAccessibilityData: BellAccessibilityData? = null
    var loggingDirectives: LoggingDirectives? = null
}

class SubscribedButtonText {
    var runs: ArrayList<Run>? = null
}

class SubscribeEndpoint {
    var channelIds: ArrayList<String>? = null
    var params: String? = null
}

class SubscriberCountText {
    var accessibility: Accessibility? = null
    var simpleText: String? = null
}

class SubscribeState {
    var key: String? = null
    var subscribed: Boolean = false
}

class SubscriptionNotificationStateEntity {
    var key: String? = null
    var state: String? = null
}

class SubscriptionStateEntity {
    var key: String? = null
    var subscribed: Boolean = false
}

class Subtitle {
    var simpleText: String? = null
}

class Suffix {
    var content: String? = null
    var commandRuns: ArrayList<CommandRun>? = null
    var styleRuns: ArrayList<StyleRun>? = null
}

class Tab {
    var tabRenderer: TabRenderer? = null
    var expandableTabRenderer: ExpandableTabRenderer? = null
}

class TabRenderer {
    var endpoint: Endpoint? = null
    var title: String? = null
    var selected: Boolean = false
    var content: Content? = null
    var trackingParams: String? = null
}

class Text {
    var runs: ArrayList<Run>? = null
    var content: String? = null
    var styleRuns: ArrayList<StyleRun>? = null
    var attachmentRuns: ArrayList<AttachmentRun>? = null
    var commandRuns: ArrayList<CommandRun>? = null
    var accessibility: Accessibility? = null
    var simpleText: String? = null
}

class Thumbnail {
    var thumbnails: ArrayList<Thumbnail11>? = null
    var isOriginalAspectRatio: Boolean = false
}

class Thumbnail11 {
    var url: String? = null
    var width: Int = 0
    var height: Int = 0
}

class ThumbnailOverlay {
    var thumbnailOverlayTimeStatusRenderer: ThumbnailOverlayTimeStatusRenderer? = null
    var thumbnailOverlayToggleButtonRenderer: ThumbnailOverlayToggleButtonRenderer? = null
    var thumbnailOverlayNowPlayingRenderer: ThumbnailOverlayNowPlayingRenderer? = null
    var thumbnailOverlayResumePlaybackRenderer: ThumbnailOverlayResumePlaybackRenderer? = null
}

class ThumbnailOverlayNowPlayingRenderer {
    var text: Text? = null
}

class ThumbnailOverlayResumePlaybackRenderer {
    var percentDurationWatched: Int = 0
}

class ThumbnailOverlayTimeStatusRenderer {
    var text: Text? = null
    var style: String? = null
}

class ThumbnailOverlayToggleButtonRenderer {
    var isToggled: Boolean = false
    var untoggledIcon: UntoggledIcon? = null
    var toggledIcon: ToggledIcon? = null
    var untoggledTooltip: String? = null
    var toggledTooltip: String? = null
    var untoggledServiceEndpoint: UntoggledServiceEndpoint? = null
    var toggledServiceEndpoint: ToggledServiceEndpoint? = null
    var untoggledAccessibility: UntoggledAccessibility? = null
    var toggledAccessibility: ToggledAccessibility? = null
    var trackingParams: String? = null
}

class Timestamp {
    var seconds: String? = null
    var nanos: Int = 0
}

class Title {
    var content: String? = null
    var simpleText: String? = null
    var runs: ArrayList<Run>? = null
    var accessibility: Accessibility? = null
    var dynamicTextViewModel: DynamicTextViewModel? = null
}

class ToggledAccessibility {
    var accessibilityData: AccessibilityData? = null
}

class ToggledIcon {
    var iconType: String? = null
}

class ToggledServiceEndpoint {
    var clickTrackingParams: String? = null
    var commandMetadata: CommandMetadata? = null
    var playlistEditEndpoint: PlaylistEditEndpoint? = null
}

class TooltipText {
    var runs: ArrayList<Run>? = null
}

class Topbar {
    var desktopTopbarRenderer: DesktopTopbarRenderer? = null
}

class TopbarButton {
    var topbarMenuButtonRenderer: TopbarMenuButtonRenderer? = null
    var notificationTopbarButtonRenderer: NotificationTopbarButtonRenderer? = null
}

class TopbarLogoRenderer {
    var iconImage: IconImage? = null
    var tooltipText: TooltipText? = null
    var endpoint: Endpoint? = null
    var trackingParams: String? = null
    var overrideEntityKey: String? = null
}

class TopbarMenuButtonRenderer {
    var icon: Icon? = null
    var menuRenderer: MenuRenderer? = null
    var trackingParams: String? = null
    var accessibility: Accessibility? = null
    var tooltip: String? = null
    var style: String? = null
    var avatar: Avatar? = null
    var menuRequest: MenuRequest? = null
}

class TruncationText {
    var content: String? = null
    var styleRuns: ArrayList<StyleRun>? = null
}

class TwoColumnBrowseResultsRenderer {
    var tabs: ArrayList<Tab>? = null
}

class Type {
    var imageType: ImageType? = null
}

class UnifiedSharePanelRenderer {
    var trackingParams: String? = null
    var showLoadingSpinner: Boolean = false
}

class UnsubscribeAccessibility {
    var accessibilityData: AccessibilityData? = null
}

class UnsubscribeButtonContent {
    var buttonText: String? = null
    var accessibilityText: String? = null
    var imageName: String? = null
    var subscribeState: SubscribeState? = null
    var onTapCommand: OnTapCommand? = null
}

class UnsubscribeButtonText {
    var runs: ArrayList<Run>? = null
}

class UnsubscribedButtonText {
    var runs: ArrayList<Run>? = null
}

class UnsubscribeEndpoint {
    var channelIds: ArrayList<String>? = null
    var params: String? = null
}

class UntoggledAccessibility {
    var accessibilityData: AccessibilityData? = null
}

class UntoggledIcon {
    var iconType: String? = null
}

class UntoggledServiceEndpoint {
    var clickTrackingParams: String? = null
    var commandMetadata: CommandMetadata? = null
    var playlistEditEndpoint: PlaylistEditEndpoint? = null
    var signalServiceEndpoint: SignalServiceEndpoint? = null
}

class UpdateUnseenCountEndpoint {
    var clickTrackingParams: String? = null
    var commandMetadata: CommandMetadata? = null
    var signalServiceEndpoint: SignalServiceEndpoint? = null
}

class UploadEndpoint {
    var hack: Boolean = false
}

class UrlEndpoint {
    var url: String? = null
    var target: String? = null
}

class UserFeedbackEndpoint {
    var additionalDatas: ArrayList<AdditionalData>? = null
}

class UserFeedbackEndpointProductSpecificValueData {
    var key: String? = null
    var value: String? = null
}

class VideoCountText {
    var runs: ArrayList<Run>? = null
}

open class VideoRenderer : RssDataInterface {
    var videoId: String? = null
    var thumbnail: Thumbnail? = null
    var title: Title? = null
    var descriptionSnippet: DescriptionSnippet? = null
    var longBylineText: LongBylineText? = null
    var publishedTimeText: PublishedTimeText? = null
    var lengthText: LengthText? = null
    var viewCountText: ViewCountText? = null
    var navigationEndpoint: NavigationEndpoint? = null
    var ownerBadges: ArrayList<OwnerBadge>? = null
    var ownerText: OwnerText? = null
    var shortBylineText: ShortBylineText? = null
    var trackingParams: String? = null
    var showActionMenu: Boolean = false
    var shortViewCountText: ShortViewCountText? = null
    var menu: Menu? = null
    var channelThumbnailSupportedRenderers: ChannelThumbnailSupportedRenderers? = null
    var thumbnailOverlays: ArrayList<ThumbnailOverlay>? = null
    var avatar: Avatar? = null
    override fun title(): String {
        return shortBylineText?.runs?.get(0)?.text ?: title?.runs?.get(0)?.text ?: title?.accessibility?.label ?:  title?.accessibility?.accessibilityData?.label ?: ""
    }

    override fun thumbnailUrl(): String {
        return  thumbnail?.thumbnails?.first()?.url ?: ""
    }

    override fun originPage(): String {
        return if (navigationEndpoint?.watchEndpoint?.videoId?.length ?: 0 > 3) {
            "https://www.youtube.com/watch?v=".plus(navigationEndpoint?.watchEndpoint?.videoId)
        } else if (navigationEndpoint?.commandMetadata?.webCommandMetadata?.url?.length ?: 0 > 3 ) {
            "https://www.youtube.com".plus(navigationEndpoint?.commandMetadata?.webCommandMetadata?.url)
        } else {
            "https://youtube.com"
        }
    }

    override fun description(): String {
        return title?.accessibility?.accessibilityData?.label ?: ""
    }

    override fun pubDate(): Long {
        var date = Date()
        var dateTime = date.time
        var before = 0
        try {
            var targetDate =  publishedTimeText?.simpleText ?: publishedTimeText?.runs?.first()?.text ?: ""
            if (targetDate?.length ?: 0 > 1) {
                var dateDesc = targetDate
                var isBefore = dateDesc.contains("전")
                val dayString = dateDesc.replace("[^0-9]".toRegex(), "")
                before = dayString.toInt()
                if (dateDesc.contains("년")) {
                    before = 365 * before
                    dateTime = if (isBefore) beforeDay(date, before) else afterDay(date, before)
                } else if (dateDesc.contains("월")) {
                    before = 30 * before
                    dateTime = if (isBefore) beforeDay(date, before) else afterDay(date, before)
                } else if (dateDesc.contains("주")) {
                    before = 7 * before
                    dateTime = if (isBefore) beforeDay(date, before) else afterDay(date, before)
                } else if (dateDesc.contains("일")) {
                    dateTime = if (isBefore) beforeDay(date, before) else afterDay(date, before)
                } else if (dateDesc.contains("시간")) {
                    dateTime = if (isBefore)dateTime.minus(before.times(1000L * 60L * 60L)) else dateTime.plus(before.times(1000L * 60L * 60L))
                } else if (dateDesc.contains("분")) {
                    dateTime = if (isBefore)dateTime.minus(before.times(1000L * 60L)) else dateTime.plus(before.times(1000L * 60L))
                }
            }
        }catch (e : Exception) {

        }


        return dateTime
    }

    override fun category(): RssDataType {
        return RssDataType.YOUTUBE
    }
    override fun getCho(): String? {
        return JamoUtils.split(title()).joinToString("")
    }
}

class ViewCountText {
    var simpleText: String? = null
    var accessibility: Accessibility? = null
}

class Visibility {
    var types: String? = null
}

class VisibilityButton {
    var buttonRenderer: ButtonRenderer? = null
}

class VoiceSearchButton {
    var buttonRenderer: ButtonRenderer? = null
}

class VoiceSearchDialogRenderer {
    var placeholderHeader: PlaceholderHeader? = null
    var promptHeader: PromptHeader? = null
    var exampleQuery1: ExampleQuery1? = null
    var exampleQuery2: ExampleQuery2? = null
    var promptMicrophoneLabel: PromptMicrophoneLabel? = null
    var loadingHeader: LoadingHeader? = null
    var connectionErrorHeader: ConnectionErrorHeader? = null
    var connectionErrorMicrophoneLabel: ConnectionErrorMicrophoneLabel? = null
    var permissionsHeader: PermissionsHeader? = null
    var permissionsSubtext: PermissionsSubtext? = null
    var disabledHeader: DisabledHeader? = null
    var disabledSubtext: DisabledSubtext? = null
    var microphoneButtonAriaLabel: MicrophoneButtonAriaLabel? = null
    var exitButton: ExitButton? = null
    var trackingParams: String? = null
    var microphoneOffPromptHeader: MicrophoneOffPromptHeader? = null
}

class VssLoggingContext {
    var serializedContextData: String? = null
}

class WatchEndpoint {
    var videoId: String? = null
    var watchEndpointSupportedOnesieConfig: WatchEndpointSupportedOnesieConfig? = null
    var params: String? = null
    var startTimeSeconds: Int = 0
    var playlistId: String? = null
    var loggingContext: LoggingContext? = null
}

class WatchEndpointSupportedOnesieConfig {
    var html5PlaybackOnesieConfig: Html5PlaybackOnesieConfig? = null
}

class WebCommandMetadata {
    var url: String? = null
    var webPageType: String? = null
    var rootVe: Int = 0
    var apiUrl: String? = null
    var sendPost: Boolean = false
    var ignoreNavigation: Boolean = false
}

class WebResponseContextExtensionData {
    var ytConfigData: YtConfigData? = null
    var hasDecorated: Boolean = false
}

class WebSearchboxConfig {
    var requestLanguage: String? = null
    var requestDomain: String? = null
    var hasOnscreenKeyboard: Boolean = false
    var focusSearchbox: Boolean = false
}

class Width {
    var value: Int = 0
    var unit: String? = null
}

class YpcGetOffersEndpoint {
    var params: String? = null
}

class YtConfigData {
    var visitorData: String? = null
    var sessionIndex: Int = 0
    var rootVisualElementType: Int = 0
}

class YoutubeData {
    //    var responseContext: ResponseContext? = null
    var contents: JSONObject? = null
    var header: JSONObject? = null
    var metadata: JSONObject? = null
    //    var trackingParams: String? = null
//    var topbar: Topbar? = null
    var microformat: JSONObject? = null
//    var onResponseReceivedActions: ArrayList<OnResponseReceivedAction>? = null
//    var frameworkUpdates: FrameworkUpdates? = null

}