Remove 'less' button in playlist descriptions

This commit is contained in:
Omar Roth 2018-09-13 21:00:39 -05:00
parent b7acdfad24
commit 62ae836565
2 changed files with 8 additions and 3 deletions

View file

@ -119,13 +119,18 @@ end
def fetch_playlist(plid)
client = make_client(YT_URL)
response = client.get("/playlist?list=#{plid}&disable_polymer=1")
document = XML.parse_html(response.body)
body = response.body.gsub(<<-END_BUTTON
<button class="yt-uix-button yt-uix-button-size-default yt-uix-button-link yt-uix-expander-head playlist-description-expander yt-uix-inlineedit-ignore-edit" type="button" onclick=";return false;"><span class="yt-uix-button-content"> less <img alt="" src="/yts/img/pixel-vfl3z5WfW.gif">
</span></button>
END_BUTTON
, "")
document = XML.parse_html(body)
title = document.xpath_node(%q(//h1[@class="pl-header-title"])).not_nil!.content
title = title.strip(" \n")
description_html = document.xpath_node(%q(//span[@class="pl-header-description-text"]/div/div[1]))
description, description_html = html_to_content(description_html)
description_html, description = html_to_content(description_html)
anchor = document.xpath_node(%q(//ul[@class="pl-header-details"])).not_nil!
author = anchor.xpath_node(%q(.//li[1]/a)).not_nil!.content

View file

@ -16,7 +16,7 @@
</div>
<div class="h-box">
<p><%= playlist.description %></p>
<p><%= playlist.description_html %></p>
</div>
<% videos.each_slice(4) do |slice| %>