|
|
@ -524,7 +524,7 @@ def get_reddit_comments(id, client, headers)
|
|
|
|
thread = search_results.data.as(RedditListing).children.sort_by { |child| child.data.as(RedditLink).score }[-1]
|
|
|
|
thread = search_results.data.as(RedditListing).children.sort_by { |child| child.data.as(RedditLink).score }[-1]
|
|
|
|
thread = thread.data.as(RedditLink)
|
|
|
|
thread = thread.data.as(RedditLink)
|
|
|
|
|
|
|
|
|
|
|
|
result = client.get("/r/#{thread.subreddit}/comments/#{thread.id}?limit=100&sort=top", headers).body
|
|
|
|
result = client.get("/r/#{thread.subreddit}/comments/#{thread.id}.json?limit=100&sort=top", headers).body
|
|
|
|
result = Array(RedditThing).from_json(result)
|
|
|
|
result = Array(RedditThing).from_json(result)
|
|
|
|
elsif search_results.status_code == 302
|
|
|
|
elsif search_results.status_code == 302
|
|
|
|
result = client.get(search_results.headers["Location"], headers).body
|
|
|
|
result = client.get(search_results.headers["Location"], headers).body
|
|
|
@ -562,7 +562,9 @@ def template_youtube_comments(comments)
|
|
|
|
<div class="pure-g">
|
|
|
|
<div class="pure-g">
|
|
|
|
<div class="pure-u-1">
|
|
|
|
<div class="pure-u-1">
|
|
|
|
<p>
|
|
|
|
<p>
|
|
|
|
<a href="javascript:void(0)" onclick="toggle(this)">[ - ]</a> <i class="icon ion-ios-thumbs-up"></i> #{child["likeCount"]} <b>#{child["author"]}</b>
|
|
|
|
<a href="javascript:void(0)" onclick="toggle(this)">[ - ]</a>
|
|
|
|
|
|
|
|
<i class="icon ion-ios-thumbs-up"></i> #{child["likeCount"]}
|
|
|
|
|
|
|
|
<b><a href="#{child["authorUrl"]}">#{child["author"]}</a></b>
|
|
|
|
</p>
|
|
|
|
</p>
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
#{child["content"]}
|
|
|
|
#{child["content"]}
|
|
|
@ -606,7 +608,9 @@ def template_reddit_comments(root)
|
|
|
|
|
|
|
|
|
|
|
|
content = <<-END_HTML
|
|
|
|
content = <<-END_HTML
|
|
|
|
<p>
|
|
|
|
<p>
|
|
|
|
<a href="javascript:void(0)" onclick="toggle(this)">[ - ]</a> <i class="icon ion-ios-thumbs-up"></i> #{score} <b>#{author}</b>
|
|
|
|
<a href="javascript:void(0)" onclick="toggle(this)">[ - ]</a>
|
|
|
|
|
|
|
|
<i class="icon ion-ios-thumbs-up"></i> #{score}
|
|
|
|
|
|
|
|
<b><a href="https://www.reddit.com/user/#{author}">#{author}</a></b>
|
|
|
|
</p>
|
|
|
|
</p>
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
#{body_html}
|
|
|
|
#{body_html}
|
|
|
@ -721,7 +725,13 @@ def fill_links(html, scheme, host)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if host == "www.youtube.com"
|
|
|
|
html = html.xpath_node(%q(//p[@id="eow-description"])).not_nil!.to_xml
|
|
|
|
html = html.xpath_node(%q(//p[@id="eow-description"])).not_nil!.to_xml
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
html = html.to_xml(options: XML::SaveOptions::NO_DECL)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
html
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def login_req(login_form, f_req)
|
|
|
|
def login_req(login_form, f_req)
|
|
|
|