mirror of
https://github.com/iv-org/invidious.git
synced 2024-11-14 04:08:23 +00:00
Update keywords and view_count
This commit is contained in:
parent
19516eaa25
commit
c92f6e44e7
@ -2087,11 +2087,7 @@ get "/api/v1/videos/:id" do |env|
|
|||||||
json.field "descriptionHtml", video.description
|
json.field "descriptionHtml", video.description
|
||||||
json.field "published", video.published.epoch
|
json.field "published", video.published.epoch
|
||||||
json.field "publishedText", "#{recode_date(video.published)} ago"
|
json.field "publishedText", "#{recode_date(video.published)} ago"
|
||||||
json.field "keywords" do
|
json.field "keywords", video.keywords
|
||||||
json.array do
|
|
||||||
video.info["keywords"].split(",").each { |keyword| json.string keyword }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
json.field "viewCount", video.views
|
json.field "viewCount", video.views
|
||||||
json.field "likeCount", video.likes
|
json.field "likeCount", video.likes
|
||||||
|
@ -262,6 +262,10 @@ class Video
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def keywords
|
||||||
|
return self.player_response["videoDetails"]["keywords"].as_a
|
||||||
|
end
|
||||||
|
|
||||||
def fmt_stream(decrypt_function)
|
def fmt_stream(decrypt_function)
|
||||||
streams = [] of HTTP::Params
|
streams = [] of HTTP::Params
|
||||||
self.info["url_encoded_fmt_stream_map"].split(",") do |string|
|
self.info["url_encoded_fmt_stream_map"].split(",") do |string|
|
||||||
@ -638,16 +642,19 @@ def fetch_video(id, proxies)
|
|||||||
end
|
end
|
||||||
|
|
||||||
title = info["title"]
|
title = info["title"]
|
||||||
views = info["view_count"].to_i64
|
|
||||||
author = info["author"]
|
author = info["author"]
|
||||||
ucid = info["ucid"]
|
ucid = info["ucid"]
|
||||||
|
|
||||||
|
views = html.xpath_node(%q(//meta[@itemprop="interactionCount"]))
|
||||||
|
views = views.try &.["content"].to_i64?
|
||||||
|
views ||= 0_i64
|
||||||
|
|
||||||
likes = html.xpath_node(%q(//button[@title="I like this"]/span))
|
likes = html.xpath_node(%q(//button[@title="I like this"]/span))
|
||||||
likes = likes.try &.content.delete(",").try &.to_i
|
likes = likes.try &.content.delete(",").try &.to_i?
|
||||||
likes ||= 0
|
likes ||= 0
|
||||||
|
|
||||||
dislikes = html.xpath_node(%q(//button[@title="I dislike this"]/span))
|
dislikes = html.xpath_node(%q(//button[@title="I dislike this"]/span))
|
||||||
dislikes = dislikes.try &.content.delete(",").try &.to_i
|
dislikes = dislikes.try &.content.delete(",").try &.to_i?
|
||||||
dislikes ||= 0
|
dislikes ||= 0
|
||||||
|
|
||||||
description = html.xpath_node(%q(//p[@id="eow-description"]))
|
description = html.xpath_node(%q(//p[@id="eow-description"]))
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<% content_for "header" do %>
|
<% content_for "header" do %>
|
||||||
<meta name="thumbnail" content="<%= thumbnail %>">
|
<meta name="thumbnail" content="<%= thumbnail %>">
|
||||||
<meta name="description" content="<%= description %>">
|
<meta name="description" content="<%= description %>">
|
||||||
<meta name="keywords" content="<%= video.info["keywords"] %>">
|
<meta name="keywords" content="<%= video.keywords.join(",") %>">
|
||||||
<meta property="og:site_name" content="Invidious">
|
<meta property="og:site_name" content="Invidious">
|
||||||
<meta property="og:url" content="<%= host_url %>/watch?v=<%= video.id %>">
|
<meta property="og:url" content="<%= host_url %>/watch?v=<%= video.id %>">
|
||||||
<meta property="og:title" content="<%= HTML.escape(video.title) %>">
|
<meta property="og:title" content="<%= HTML.escape(video.title) %>">
|
||||||
|
Loading…
Reference in New Issue
Block a user