Add fix for parsing videos with 1 view

pull/91/head
Omar Roth 6 years ago
parent 8c22c226c0
commit e47b95ff42

@ -2279,12 +2279,12 @@ get "/api/v1/channels/:ucid/videos" do |env|
if metadata.size == 0 if metadata.size == 0
next next
elsif metadata.size == 1 elsif metadata.size == 1
view_count = metadata[0].content.rchop(" watching").delete(",").to_i64 view_count = metadata[0].content.split(" ")[0].delete(",").to_i64
published = Time.now published = Time.now
else else
published = decode_date(metadata[0].content) published = decode_date(metadata[0].content)
view_count = metadata[1].content.rchop(" views") view_count = metadata[1].content.split(" ")[0]
if view_count == "No" if view_count == "No"
view_count = 0_i64 view_count = 0_i64
else else

@ -44,12 +44,12 @@ def search(query, page = 1, search_params = build_search_params(content_type: "v
if metadata.size == 0 if metadata.size == 0
next next
elsif metadata.size == 1 elsif metadata.size == 1
view_count = metadata[0].content.rchop(" watching").delete(",").to_i64 view_count = metadata[0].content.split(" ")[0].delete(",").to_i64
published = Time.now published = Time.now
else else
published = decode_date(metadata[0].content) published = decode_date(metadata[0].content)
view_count = metadata[1].content.rchop(" views") view_count = metadata[1].content.split(" ")[0]
if view_count == "No" if view_count == "No"
view_count = 0_i64 view_count = 0_i64
else else

Loading…
Cancel
Save