mirror of https://github.com/zedeus/nitter
add player embed
This commit is contained in:
parent
138826fb4f
commit
0daa7c164f
|
@ -46,8 +46,10 @@ proc createStatusRouter*(cfg: Config) =
|
|||
video = ""
|
||||
|
||||
if conv.tweet.video.isSome():
|
||||
images = @[get(conv.tweet.video).thumb]
|
||||
video = getVideoEmbed(cfg, conv.tweet.id)
|
||||
let vid = get(conv.tweet.video)
|
||||
images = @[vid.thumb]
|
||||
let vids = vid.variants.filterIt(it.contentType == VideoType.mp4)
|
||||
video = getVidUrl(vids[0].url)
|
||||
elif conv.tweet.gif.isSome():
|
||||
images = @[get(conv.tweet.gif).thumb]
|
||||
video = getPicUrl(get(conv.tweet.gif).url)
|
||||
|
|
|
@ -109,13 +109,17 @@ proc renderHead*(prefs: Prefs; cfg: Config; req: Request; titleText=""; desc="";
|
|||
|
||||
if rss.len > 0:
|
||||
meta(property="twitter:card", content="summary")
|
||||
elif video.len > 0:
|
||||
meta(property="twitter:card", content="player")
|
||||
else:
|
||||
meta(property="twitter:card", content="summary_large_image")
|
||||
|
||||
if video.len > 0:
|
||||
meta(property="og:video:url", content=video)
|
||||
meta(property="og:video:secure_url", content=video)
|
||||
meta(property="og:video:type", content="text/html")
|
||||
meta(property="og:video:type", content="video/mp4")
|
||||
meta(name="twitter:player:stream", content=video)
|
||||
meta(name="twitter:player:stream:content_type", content="video/mp4")
|
||||
|
||||
# this is last so images are also preloaded
|
||||
# if this is done earlier, Chrome only preloads one image for some reason
|
||||
|
|
Loading…
Reference in New Issue