Fix video count in playlist extractor
This commit is contained in:
parent
ce2a3361eb
commit
80a567bf1e
|
@ -241,7 +241,7 @@ def extract_items(nodeset, ucid = nil, author_name = nil)
|
|||
video_count = video_count.rchop("+")
|
||||
end
|
||||
|
||||
video_count = video_count.to_i?
|
||||
video_count = video_count.gsub(/\D/, "").to_i?
|
||||
end
|
||||
video_count ||= 0
|
||||
|
||||
|
@ -301,10 +301,10 @@ def extract_items(nodeset, ucid = nil, author_name = nil)
|
|||
|
||||
author_thumbnail ||= ""
|
||||
|
||||
subscriber_count = node.xpath_node(%q(.//span[contains(@class, "yt-subscriber-count")])).try &.["title"].delete(",").to_i?
|
||||
subscriber_count = node.xpath_node(%q(.//span[contains(@class, "yt-subscriber-count")])).try &.["title"].gsub(/\D/, "").to_i?
|
||||
subscriber_count ||= 0
|
||||
|
||||
video_count = node.xpath_node(%q(.//ul[@class="yt-lockup-meta-info"]/li)).try &.content.split(" ")[0].delete(",").to_i?
|
||||
video_count = node.xpath_node(%q(.//ul[@class="yt-lockup-meta-info"]/li)).try &.content.split(" ")[0].gsub(/\D/, "").to_i?
|
||||
video_count ||= 0
|
||||
|
||||
items << SearchChannel.new(
|
||||
|
@ -466,7 +466,7 @@ def extract_shelf_items(nodeset, ucid = nil, author_name = nil)
|
|||
|
||||
video_count_label = child_node.xpath_node(%q(.//span[@class="formatted-video-count-label"]))
|
||||
if video_count_label
|
||||
video_count = video_count_label.content.strip.match(/^\d+/).try &.[0].to_i?
|
||||
video_count = video_count_label.content.gsub(/\D/, "").to_i?
|
||||
end
|
||||
video_count ||= 50
|
||||
|
||||
|
|
|
@ -196,7 +196,7 @@ def fetch_playlist(plid, locale)
|
|||
author_thumbnail ||= ""
|
||||
ucid = anchor.xpath_node(%q(.//li[1]/a)).not_nil!["href"].split("/")[-1]
|
||||
|
||||
video_count = anchor.xpath_node(%q(.//li[2])).not_nil!.content.delete("videos, ").to_i
|
||||
video_count = anchor.xpath_node(%q(.//li[2])).not_nil!.content.gsub(/\D/, "").to_i
|
||||
views = anchor.xpath_node(%q(.//li[3])).not_nil!.content.delete("No views, ")
|
||||
if views.empty?
|
||||
views = 0_i64
|
||||
|
|
Loading…
Reference in a new issue