Fix view_count_text extractor for livestreams

pull/530/head
Omar Roth 6 years ago
parent 3f738cf905
commit 757993064e
No known key found for this signature in database
GPG Key ID: B8254FB7EC3D37F2

@ -929,7 +929,7 @@ def extract_polymer_config(body, html)
recommended_video["author_thumbnail"] = compact_renderer["channelThumbnail"]["thumbnails"][0]["url"].as_s recommended_video["author_thumbnail"] = compact_renderer["channelThumbnail"]["thumbnails"][0]["url"].as_s
recommended_video["short_view_count_text"] = compact_renderer["shortViewCountText"]["simpleText"].as_s recommended_video["short_view_count_text"] = compact_renderer["shortViewCountText"]["simpleText"].as_s
recommended_video["view_count"] = compact_renderer["viewCountText"]?.try &.["simpleText"]?.try &.as_s.delete(", views").to_i64?.try &.to_s || "0" recommended_video["view_count"] = compact_renderer["viewCountText"]?.try &.["simpleText"]?.try &.as_s.delete(", views watching").to_i64?.try &.to_s || "0"
recommended_video["length_seconds"] = decode_length_seconds(compact_renderer["lengthText"]?.try &.["simpleText"]?.try &.as_s || "0:00").to_s recommended_video["length_seconds"] = decode_length_seconds(compact_renderer["lengthText"]?.try &.["simpleText"]?.try &.as_s || "0:00").to_s
rvs << recommended_video.to_s rvs << recommended_video.to_s

@ -212,7 +212,7 @@
</div> </div>
<div class="pure-u-10-24" style="text-align:right"> <div class="pure-u-10-24" style="text-align:right">
<% if views = rv["short_view_count_text"]?.try &.delete(", views") %> <% if views = rv["short_view_count_text"]?.try &.delete(", views watching") %>
<b class="width:100%"><%= translate(locale, "`x` views", views) %></b> <b class="width:100%"><%= translate(locale, "`x` views", views) %></b>
<% end %> <% end %>
</div> </div>

Loading…
Cancel
Save