Types
NbcArticleAuthor = ref object name*: string url*: string image*: string isFeatured: bool job*: string
- Source Edit
NbcArticleImage = ref object src*: string authors*: seq[string] publisher*: string source*: string alt*: string caption*: string
- Source Edit
NbcArticleTopic = ref object name*: string url*: string
- Source Edit
NbcPage = ref object highlighted*: seq[NbcPost] byCategory*: GroupedPosts ## Example: politics byGroup*: GroupedPosts ## Example: top stories teases*: GroupedPosts
- Source Edit
NbcPost = ref object image*: NbcArticleImage topic*: NbcArticleTopic url*: string datePublished*, dateCreated*, dateModified*: string ## TODO: parse date headline*: string case kind*: NbcPostKind of pkArticle: subhead*: string authors: seq[NbcArticleAuthor] breakingNews*: bool related: seq[NbcPost] of pkVideo: captions: NbcVideoCaption dateBroadcast*: string description*: string publisher*: string source*: string duration*: int ## seconds src*: seq[NbcVideoSource]
- Source Edit
NbcPostKind = enum pkArticle, pkVideo
- Source Edit
NbcVideoCaption = ref object smptett*: string srt*: string webvtt*: string
- Source Edit
NbcVideoSource = ref object format*: string url*: string duration*: float ## seconds bitrate*: int width*, height*: int
- Source Edit
Procs
proc getNbcPage(url = "https://www.nbcnews.com/"): Future[NbcPage] {. ...raises: [Exception, ValueError], tags: [RootEffect, ReadDirEffect, ReadEnvEffect, TimeEffect, ReadIOEffect, WriteIOEffect], forbids: [].}
-
Extracts the main page of NBC news
Works with:
- https://www.nbcnews.com
- https://www.today.com
- https://www.today.com/news
- https://www.nbcnews.com/video
- https://www.nbcnews.com/category