mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-03-16.git
synced 2024-08-15 00:53:18 +00:00
Update keywords and view_count
This commit is contained in:
parent
19516eaa25
commit
c92f6e44e7
4 changed files with 14 additions and 11 deletions
|
@ -2087,11 +2087,7 @@ get "/api/v1/videos/:id" do |env|
|
|||
json.field "descriptionHtml", video.description
|
||||
json.field "published", video.published.epoch
|
||||
json.field "publishedText", "#{recode_date(video.published)} ago"
|
||||
json.field "keywords" do
|
||||
json.array do
|
||||
video.info["keywords"].split(",").each { |keyword| json.string keyword }
|
||||
end
|
||||
end
|
||||
json.field "keywords", video.keywords
|
||||
|
||||
json.field "viewCount", video.views
|
||||
json.field "likeCount", video.likes
|
||||
|
|
|
@ -262,6 +262,10 @@ class Video
|
|||
end
|
||||
end
|
||||
|
||||
def keywords
|
||||
return self.player_response["videoDetails"]["keywords"].as_a
|
||||
end
|
||||
|
||||
def fmt_stream(decrypt_function)
|
||||
streams = [] of HTTP::Params
|
||||
self.info["url_encoded_fmt_stream_map"].split(",") do |string|
|
||||
|
@ -638,16 +642,19 @@ def fetch_video(id, proxies)
|
|||
end
|
||||
|
||||
title = info["title"]
|
||||
views = info["view_count"].to_i64
|
||||
author = info["author"]
|
||||
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 = likes.try &.content.delete(",").try &.to_i
|
||||
likes = likes.try &.content.delete(",").try &.to_i?
|
||||
likes ||= 0
|
||||
|
||||
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
|
||||
|
||||
description = html.xpath_node(%q(//p[@id="eow-description"]))
|
||||
|
|
|
@ -106,4 +106,4 @@ function unsubscribe() {
|
|||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<% content_for "header" do %>
|
||||
<meta name="thumbnail" content="<%= thumbnail %>">
|
||||
<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:url" content="<%= host_url %>/watch?v=<%= video.id %>">
|
||||
<meta property="og:title" content="<%= HTML.escape(video.title) %>">
|
||||
|
@ -451,4 +451,4 @@ function get_youtube_replies(target, load_more) {
|
|||
get_youtube_comments();
|
||||
<% end %>
|
||||
|
||||
</script>
|
||||
</script>
|
||||
|
|
Loading…
Reference in a new issue