Add 'paid' and 'premium' flags to API

This commit is contained in:
Omar Roth
2018-10-16 11:15:14 -05:00
parent 8b69e23471
commit 1cfa1f6559
4 changed files with 44 additions and 1 deletions

View File

@@ -358,6 +358,18 @@ def extract_items(nodeset, ucid = nil)
live_now = false
end
if node.xpath_node(%q(.//span[text()="Premium"]))
premium = true
else
premium = false
end
if node.xpath_node(%q(.//span[contains(text(), "Get YouTube Premium")]))
paid = true
else
paid = false
end
items << SearchVideo.new(
title,
id,
@@ -368,7 +380,9 @@ def extract_items(nodeset, ucid = nil)
description,
description_html,
length_seconds,
live_now
live_now,
paid,
premium
)
end
end