From 53acf1f6d6d3dcc2d47b89b9ae5debbf59da6b9c Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Sun, 4 Mar 2018 09:31:26 -0600 Subject: [PATCH] Use more advanced query for reddit search --- src/helpers.cr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/helpers.cr b/src/helpers.cr index e26c464f..4f671e46 100644 --- a/src/helpers.cr +++ b/src/helpers.cr @@ -249,8 +249,8 @@ def make_client(url, context) end def get_reddit_comments(id, client) - youtube_url = "https://www.youtube.com/watch?v=#{id}" - search_results = client.get("/submit.json?url=#{youtube_url}") + query = "(url:3D#{id}%20OR%20url:#{id})%20(site:youtube.com%20OR%20site:youtu.be)" + search_results = client.get("/search.json?q=#{query}") if search_results.status_code == 302 search_results = client.get(search_results.headers["Location"]).body