Skip to content

Instantly share code, notes, and snippets.

anonymous
anonymous / reddit_youtube_relinker.rb
Created March 26, 2014 03:05
Try to link a given reddit comment to a YouTube video. Only looks at top-level comments. Will pull a direct YouTube link out if exists. Otherwise, will count on the majik of Google's "I'm Feeling Lucky" + Video search.
# try to link a given reddit comment to a YouTube video
# only looks at top-level comments
# will pull a direct YouTube link out if exists
# otherwise, will count on the majik of Google's "I'm Feeling Lucky" + Video search
require 'json'
require 'open-uri'
# read the comments LIKE A BAWS
contents = open("http://www.reddit.com/r/running/comments/21c8u5/when_this_song_hits_your_ipod_you_explode_with.json?limit=500").read