mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-08-14.git
synced 2024-08-15 00:53:20 +00:00
Refactor 'description_html'
This commit is contained in:
parent
12b2ab5da8
commit
b43e9ed7e7
8 changed files with 69 additions and 103 deletions
|
@ -473,9 +473,8 @@ get "/watch" do |env|
|
|||
|
||||
aspect_ratio = "16:9"
|
||||
|
||||
video.description = fill_links(video.description, "https", "www.youtube.com")
|
||||
video.description = replace_links(video.description)
|
||||
description = video.short_description
|
||||
video.description_html = fill_links(video.description_html, "https", "www.youtube.com")
|
||||
video.description_html = replace_links(video.description_html)
|
||||
|
||||
host_url = make_host_url(config, Kemal.config)
|
||||
host_params = env.request.query_params
|
||||
|
@ -648,9 +647,8 @@ get "/embed/:id" do |env|
|
|||
|
||||
aspect_ratio = nil
|
||||
|
||||
video.description = fill_links(video.description, "https", "www.youtube.com")
|
||||
video.description = replace_links(video.description)
|
||||
description = video.short_description
|
||||
video.description_html = fill_links(video.description_html, "https", "www.youtube.com")
|
||||
video.description_html = replace_links(video.description_html)
|
||||
|
||||
host_url = make_host_url(config, Kemal.config)
|
||||
host_params = env.request.query_params
|
||||
|
@ -2466,7 +2464,7 @@ get "/feed/channel/:ucid" do |env|
|
|||
|
||||
author = entry.xpath_node("author/name").not_nil!.content
|
||||
ucid = entry.xpath_node("channelid").not_nil!.content
|
||||
description = entry.xpath_node("group/description").not_nil!.content
|
||||
description_html = entry.xpath_node("group/description").not_nil!.to_s
|
||||
views = entry.xpath_node("group/community/statistics").not_nil!.["views"].to_i64
|
||||
|
||||
videos << SearchVideo.new(
|
||||
|
@ -2476,8 +2474,7 @@ get "/feed/channel/:ucid" do |env|
|
|||
ucid: ucid,
|
||||
published: published,
|
||||
views: views,
|
||||
description: description,
|
||||
description_html: "",
|
||||
description_html: description_html,
|
||||
length_seconds: 0,
|
||||
live_now: false,
|
||||
paid: false,
|
||||
|
@ -3460,11 +3457,8 @@ get "/api/v1/top" do |env|
|
|||
json.field "published", video.published.to_unix
|
||||
json.field "publishedText", translate(locale, "`x` ago", recode_date(video.published, locale))
|
||||
|
||||
description = video.description.gsub("<br>", "\n")
|
||||
description = description.gsub("<br/>", "\n")
|
||||
description = XML.parse_html(description)
|
||||
json.field "description", description.content
|
||||
json.field "descriptionHtml", video.description
|
||||
json.field "description", html_to_content(video.description_html)
|
||||
json.field "descriptionHtml", video.description_html
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -3511,8 +3505,7 @@ get "/api/v1/channels/:ucid" do |env|
|
|||
author = channel_html.xpath_node(%q(//a[contains(@class, "branded-page-header-title-link")])).not_nil!.content
|
||||
author_url = channel_html.xpath_node(%q(//a[@class="channel-header-profile-image-container spf-link"])).not_nil!["href"]
|
||||
author_thumbnail = channel_html.xpath_node(%q(//img[@class="channel-header-profile-image"])).not_nil!["src"]
|
||||
description_html = channel_html.xpath_node(%q(//div[contains(@class,"about-description")]))
|
||||
description_html, description = html_to_content(description_html)
|
||||
description_html = channel_html.xpath_node(%q(//div[contains(@class,"about-description")])).try &.to_s || ""
|
||||
|
||||
paid = channel_html.xpath_node(%q(//meta[@itemprop="paid"])).not_nil!["content"] == "True"
|
||||
is_family_friendly = channel_html.xpath_node(%q(//meta[@itemprop="isFamilyFriendly"])).not_nil!["content"] == "True"
|
||||
|
@ -3607,7 +3600,7 @@ get "/api/v1/channels/:ucid" do |env|
|
|||
|
||||
json.field "autoGenerated", auto_generated
|
||||
json.field "isFamilyFriendly", is_family_friendly
|
||||
json.field "description", description
|
||||
json.field "description", html_to_content(description_html)
|
||||
json.field "descriptionHtml", description_html
|
||||
|
||||
json.field "allowedRegions", allowed_regions
|
||||
|
@ -3884,7 +3877,7 @@ get "/api/v1/playlists/:plid" do |env|
|
|||
end
|
||||
end
|
||||
|
||||
json.field "description", playlist.description
|
||||
json.field "description", html_to_content(playlist.description_html)
|
||||
json.field "descriptionHtml", playlist.description_html
|
||||
json.field "videoCount", playlist.video_count
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue