このリポジトリは2023-09-09にアーカイブされています。 ファイルの閲覧とクローンは可能ですが、プッシュ、イシューの作成、プルリクエストはできません。
Nitter-mod/src/types.nim

105 行
2.0 KiB
Nim
Raw 通常表示 履歴

2019-06-21 03:04:18 +09:00
import times, sequtils, strutils, options
import norm/sqlite
2019-06-20 23:16:20 +09:00
2019-06-21 03:04:18 +09:00
export sqlite, options
db("cache.db", "", "", ""):
type
Profile* = object
username*: string
fullname*: string
2019-06-24 09:09:32 +09:00
bio*: string
2019-06-21 03:04:18 +09:00
userpic*: string
banner*: string
following*: string
followers*: string
tweets*: string
verified* {.
dbType: "STRING",
parseIt: parseBool(it.s)
formatIt: $it
.}: bool
protected* {.
dbType: "STRING",
parseIt: parseBool(it.s)
formatIt: $it
.}: bool
updated* {.
dbType: "INTEGER",
parseIt: it.i.fromUnix(),
formatIt: getTime().toUnix()
.}: Time
2019-06-20 23:16:20 +09:00
2019-06-21 03:04:18 +09:00
type
2019-06-25 14:37:44 +09:00
VideoType* = enum
2019-06-29 14:45:36 +09:00
vmap, m3u8, mp4
2019-06-25 14:37:44 +09:00
2019-06-24 12:14:14 +09:00
Video* = object
2019-06-29 14:45:36 +09:00
contentId*: string
playbackType*: VideoType
durationMs*: int
2019-06-24 12:14:14 +09:00
url*: string
thumb*: string
views*: string
available*: bool
Gif* = object
url*: string
thumb*: string
2019-06-29 21:11:23 +09:00
Poll* = object
options*: seq[string]
values*: seq[int]
votes*: string
status*: string
leader*: int
2019-06-24 15:07:36 +09:00
Quote* = object
2019-06-24 12:14:14 +09:00
id*: string
profile*: Profile
text*: string
2019-06-25 09:58:33 +09:00
sensitive*: bool
2019-06-24 15:07:36 +09:00
thumb*: Option[string]
badge*: Option[string]
2019-06-24 12:14:14 +09:00
2019-07-02 06:22:00 +09:00
Retweet* = object
by*: string
id*: string
2019-06-24 12:14:14 +09:00
Tweet* = ref object
2019-06-20 23:16:20 +09:00
id*: string
profile*: Profile
text*: string
time*: Time
shortTime*: string
replies*: string
retweets*: string
likes*: string
pinned*: bool
2019-07-02 06:22:00 +09:00
retweet*: Option[Retweet]
2019-06-24 12:14:14 +09:00
quote*: Option[Quote]
gif*: Option[Gif]
video*: Option[Video]
photos*: seq[string]
2019-06-29 21:11:23 +09:00
poll*: Option[Poll]
2019-06-27 04:06:42 +09:00
available*: bool
2019-06-20 23:16:20 +09:00
2019-07-01 10:13:12 +09:00
Thread* = object
tweets*: seq[Tweet]
more*: int
2019-06-20 23:16:20 +09:00
2019-06-24 12:14:14 +09:00
Conversation* = ref object
2019-06-20 23:16:20 +09:00
tweet*: Tweet
2019-07-01 10:13:12 +09:00
before*: Thread
after*: Thread
replies*: seq[Thread]
2019-06-20 23:16:20 +09:00
Timeline* = ref object
2019-07-01 10:13:12 +09:00
tweets*: seq[Tweet]
minId*: string
maxId*: string
hasMore*: bool
2019-07-01 10:13:12 +09:00
proc contains*(thread: Thread; tweet: Tweet): bool =
thread.tweets.anyIt(it.id == tweet.id)