|
|
@ -1407,21 +1407,26 @@ get "/feed/channel/:ucid" do |env|
|
|
|
|
auto_generated = true
|
|
|
|
auto_generated = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
url = produce_channel_videos_url(ucid, auto_generated: auto_generated)
|
|
|
|
page = 1
|
|
|
|
response = client.get(url)
|
|
|
|
|
|
|
|
json = JSON.parse(response.body)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if json["content_html"]? && !json["content_html"].as_s.empty?
|
|
|
|
videos = [] of SearchVideo
|
|
|
|
document = XML.parse_html(json["content_html"].as_s)
|
|
|
|
2.times do |i|
|
|
|
|
nodeset = document.xpath_nodes(%q(//li[contains(@class, "feed-item-container")]))
|
|
|
|
url = produce_channel_videos_url(ucid, page * 2 + (i - 1), auto_generated: auto_generated)
|
|
|
|
|
|
|
|
response = client.get(url)
|
|
|
|
|
|
|
|
json = JSON.parse(response.body)
|
|
|
|
|
|
|
|
|
|
|
|
if auto_generated
|
|
|
|
if json["content_html"]? && !json["content_html"].as_s.empty?
|
|
|
|
videos = extract_videos(nodeset)
|
|
|
|
document = XML.parse_html(json["content_html"].as_s)
|
|
|
|
|
|
|
|
nodeset = document.xpath_nodes(%q(//li[contains(@class, "feed-item-container")]))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if auto_generated
|
|
|
|
|
|
|
|
videos += extract_videos(nodeset)
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
videos += extract_videos(nodeset, ucid)
|
|
|
|
|
|
|
|
end
|
|
|
|
else
|
|
|
|
else
|
|
|
|
videos = extract_videos(nodeset, ucid)
|
|
|
|
break
|
|
|
|
end
|
|
|
|
end
|
|
|
|
else
|
|
|
|
|
|
|
|
videos = [] of SearchVideo
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
channel = get_channel(ucid, client, PG_DB, pull_all_videos: false)
|
|
|
|
channel = get_channel(ucid, client, PG_DB, pull_all_videos: false)
|
|
|
@ -1659,21 +1664,24 @@ get "/channel/:ucid" do |env|
|
|
|
|
auto_generated = true
|
|
|
|
auto_generated = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
url = produce_channel_videos_url(ucid, page, auto_generated: auto_generated)
|
|
|
|
videos = [] of SearchVideo
|
|
|
|
response = client.get(url)
|
|
|
|
2.times do |i|
|
|
|
|
json = JSON.parse(response.body)
|
|
|
|
url = produce_channel_videos_url(ucid, page * 2 + (i - 1), auto_generated: auto_generated)
|
|
|
|
|
|
|
|
response = client.get(url)
|
|
|
|
|
|
|
|
json = JSON.parse(response.body)
|
|
|
|
|
|
|
|
|
|
|
|
if json["content_html"]? && !json["content_html"].as_s.empty?
|
|
|
|
if json["content_html"]? && !json["content_html"].as_s.empty?
|
|
|
|
document = XML.parse_html(json["content_html"].as_s)
|
|
|
|
document = XML.parse_html(json["content_html"].as_s)
|
|
|
|
nodeset = document.xpath_nodes(%q(//li[contains(@class, "feed-item-container")]))
|
|
|
|
nodeset = document.xpath_nodes(%q(//li[contains(@class, "feed-item-container")]))
|
|
|
|
|
|
|
|
|
|
|
|
if auto_generated
|
|
|
|
if auto_generated
|
|
|
|
videos = extract_videos(nodeset)
|
|
|
|
videos += extract_videos(nodeset)
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
videos += extract_videos(nodeset, ucid)
|
|
|
|
|
|
|
|
end
|
|
|
|
else
|
|
|
|
else
|
|
|
|
videos = extract_videos(nodeset, ucid)
|
|
|
|
break
|
|
|
|
end
|
|
|
|
end
|
|
|
|
else
|
|
|
|
|
|
|
|
videos = [] of SearchVideo
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
templated "channel"
|
|
|
|
templated "channel"
|
|
|
@ -2309,21 +2317,26 @@ get "/api/v1/channels/:ucid" do |env|
|
|
|
|
auto_generated = true
|
|
|
|
auto_generated = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
url = produce_channel_videos_url(ucid, 1, auto_generated)
|
|
|
|
page = 1
|
|
|
|
response = client.get(url)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
json = JSON.parse(response.body)
|
|
|
|
videos = [] of SearchVideo
|
|
|
|
if json["content_html"]? && !json["content_html"].as_s.empty?
|
|
|
|
2.times do |i|
|
|
|
|
document = XML.parse_html(json["content_html"].as_s)
|
|
|
|
url = produce_channel_videos_url(ucid, page * 2 + (i - 1), auto_generated: auto_generated)
|
|
|
|
nodeset = document.xpath_nodes(%q(//li[contains(@class, "feed-item-container")]))
|
|
|
|
response = client.get(url)
|
|
|
|
|
|
|
|
json = JSON.parse(response.body)
|
|
|
|
|
|
|
|
|
|
|
|
if auto_generated
|
|
|
|
if json["content_html"]? && !json["content_html"].as_s.empty?
|
|
|
|
videos = extract_videos(nodeset)
|
|
|
|
document = XML.parse_html(json["content_html"].as_s)
|
|
|
|
|
|
|
|
nodeset = document.xpath_nodes(%q(//li[contains(@class, "feed-item-container")]))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if auto_generated
|
|
|
|
|
|
|
|
videos += extract_videos(nodeset)
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
videos += extract_videos(nodeset, ucid)
|
|
|
|
|
|
|
|
end
|
|
|
|
else
|
|
|
|
else
|
|
|
|
videos = extract_videos(nodeset, ucid)
|
|
|
|
break
|
|
|
|
end
|
|
|
|
end
|
|
|
|
else
|
|
|
|
|
|
|
|
videos = [] of SearchVideo
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
channel_html = client.get("/channel/#{ucid}/about?disable_polymer=1").body
|
|
|
|
channel_html = client.get("/channel/#{ucid}/about?disable_polymer=1").body
|
|
|
@ -2486,21 +2499,24 @@ get "/api/v1/channels/:ucid/videos" do |env|
|
|
|
|
auto_generated = true
|
|
|
|
auto_generated = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
url = produce_channel_videos_url(ucid, auto_generated: auto_generated)
|
|
|
|
videos = [] of SearchVideo
|
|
|
|
response = client.get(url)
|
|
|
|
2.times do |i|
|
|
|
|
json = JSON.parse(response.body)
|
|
|
|
url = produce_channel_videos_url(ucid, page * 2 + (i - 1), auto_generated: auto_generated)
|
|
|
|
|
|
|
|
response = client.get(url)
|
|
|
|
|
|
|
|
json = JSON.parse(response.body)
|
|
|
|
|
|
|
|
|
|
|
|
if json["content_html"]? && !json["content_html"].as_s.empty?
|
|
|
|
if json["content_html"]? && !json["content_html"].as_s.empty?
|
|
|
|
document = XML.parse_html(json["content_html"].as_s)
|
|
|
|
document = XML.parse_html(json["content_html"].as_s)
|
|
|
|
nodeset = document.xpath_nodes(%q(//li[contains(@class, "feed-item-container")]))
|
|
|
|
nodeset = document.xpath_nodes(%q(//li[contains(@class, "feed-item-container")]))
|
|
|
|
|
|
|
|
|
|
|
|
if auto_generated
|
|
|
|
if auto_generated
|
|
|
|
videos = extract_videos(nodeset)
|
|
|
|
videos += extract_videos(nodeset)
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
videos += extract_videos(nodeset, ucid)
|
|
|
|
|
|
|
|
end
|
|
|
|
else
|
|
|
|
else
|
|
|
|
videos = extract_videos(nodeset, ucid)
|
|
|
|
break
|
|
|
|
end
|
|
|
|
end
|
|
|
|
else
|
|
|
|
|
|
|
|
videos = [] of SearchVideo
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
result = JSON.build do |json|
|
|
|
|
result = JSON.build do |json|
|
|
|
|