import type { BlogPost } from 'floatplane/creator' ; import { settings } from './lib/helpers' ; import db from '@inrixia/db' ; export const fHistory = db < { '59f94c0bdd241b70349eb72b' : BlogPost [ ] ; } > ( './db/fHistory.json' ) ; const lttVideos = [ ... Object . values ( fHistory ) [ 0 ] ] ; const dates = { } ; const channels = Object . values ( settings . subscriptions [ '59f94c0bdd241b70349eb72b' ] . channels ) ; const lastVideoPostedDate = lttVideos [ 0 ] . releaseDate ; const postTimeDiff = 0 ; for ( const video of lttVideos ) { let videoChannel = 'LTT' ; for ( const channel of channels ) { if ( channel . identifiers === false ) continue ; for ( const identifier of channel . identifiers ) { if ( typeof identifier . type !== 'string' ) throw new Error ( `Video value for channel identifier type ${ video [ identifier . type ] } on channel ${ channel . title } is of type ${ typeof video [ identifier . type ] } not string!` ) ; else { const identifierType = identifier . type === 'description' ? 'text' : identifier . type ; if ( ( video [ identifierType ] as string ) . toLowerCase ( ) . indexOf ( identifier . check . toLowerCase ( ) ) !== - 1 ) { videoChannel = channel . title ; } } } } const releaseDate = new Date ( video . releaseDate ) ; const YEAR = releaseDate . getFullYear ( ) ; const MONTH = releaseDate . getMonth ( ) + 1 ; const DAY = releaseDate . getDate ( ) ; const HOUR = releaseDate . getHours ( ) ; const MINUTE = releaseDate . getMinutes ( ) ; dates [ `${ videoChannel }-${ YEAR }-${ MONTH }-${ DAY }-${ HOUR }-${ MINUTE }` ] ??= [ ] ; dates [ `${ videoChannel }-${ YEAR }-${ MONTH }-${ DAY }-${ HOUR }-${ MINUTE }` ] . push ( [ video . title , releaseDate ] ) ; } console . log ( Object . values ( dates ) . filter ( ( date ) => date . length > 2 ) ) ;