| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- import times, sequtils, options
- import norm/sqlite
- export sqlite, options
- type
- VideoType* = enum
- vmap, m3u8, mp4
- db("cache.db", "", "", ""):
- type
- Profile* = object
- username*: string
- fullname*: string
- location*: string
- website*: string
- bio*: string
- userpic*: string
- banner*: string
- following*: string
- followers*: string
- tweets*: string
- likes*: string
- media*: string
- verified*: bool
- protected*: bool
- joinDate* {.
- dbType: "INTEGER"
- parseIt: it.i.fromUnix()
- formatIt: dbValue(it.toUnix())
- .}: Time
- updated* {.
- dbType: "INTEGER"
- parseIt: it.i.fromUnix()
- formatIt: dbValue(getTime().toUnix())
- .}: Time
- Video* = object
- videoId*: string
- contentId*: string
- durationMs*: int
- url*: string
- thumb*: string
- views*: string
- available*: bool
- playbackType* {.
- dbType: "STRING"
- parseIt: parseEnum[VideoType](it.s)
- formatIt: dbValue($it)
- .}: VideoType
- Prefs* = object
- videoPlayback*: bool
- autoplayGifs*: bool
- hideTweetStats*: bool
- hideBanner*: bool
- stickyProfile*: bool
- replaceYouTube*: string
- replaceTwitter*: string
- type
- QueryKind* = enum
- replies, media, multi, custom = "search"
- Query* = object
- kind*: QueryKind
- filters*: seq[string]
- includes*: seq[string]
- excludes*: seq[string]
- fromUser*: seq[string]
- sep*: string
- Gif* = object
- url*: string
- thumb*: string
- GalleryPhoto* = object
- url*: string
- tweetId*: string
- color*: string
- Poll* = object
- options*: seq[string]
- values*: seq[int]
- votes*: string
- status*: string
- leader*: int
- CardKind* = enum
- summary = "summary"
- summaryLarge = "summary_large_image"
- promoWebsite = "promo_website"
- promoVideo = "promo_video_website"
- player = "player"
- liveEvent = "live_event"
- Card* = object
- kind*: CardKind
- id*: string
- query*: string
- url*: string
- title*: string
- dest*: string
- text*: string
- image*: Option[string]
- video*: Option[Video]
- Quote* = object
- id*: string
- profile*: Profile
- text*: string
- reply*: seq[string]
- hasThread*: bool
- sensitive*: bool
- available*: bool
- thumb*: string
- badge*: string
- Retweet* = object
- by*: string
- id*: string
- TweetStats* = object
- replies*: string
- retweets*: string
- likes*: string
- Tweet* = ref object
- id*: string
- threadId*: string
- profile*: Profile
- text*: string
- time*: Time
- shortTime*: string
- reply*: seq[string]
- pinned*: bool
- available*: bool
- hasThread*: bool
- stats*: TweetStats
- retweet*: Option[Retweet]
- quote*: Option[Quote]
- card*: Option[Card]
- gif*: Option[Gif]
- video*: Option[Video]
- photos*: seq[string]
- poll*: Option[Poll]
- Thread* = ref object
- tweets*: seq[Tweet]
- more*: int
- Conversation* = ref object
- tweet*: Tweet
- before*: Thread
- after*: Thread
- replies*: seq[Thread]
- Timeline* = ref object
- tweets*: seq[Tweet]
- minId*: string
- maxId*: string
- hasMore*: bool
- beginning*: bool
- query*: Option[Query]
- Config* = ref object
- address*: string
- port*: int
- title*: string
- staticDir*: string
- cacheDir*: string
- profileCacheTime*: int
- proc contains*(thread: Thread; tweet: Tweet): bool =
- thread.tweets.anyIt(it.id == tweet.id)
|