Skip to content

Instantly share code, notes, and snippets.

@uhhuhyeah
Created October 19, 2009 00:01
Show Gist options
  • Save uhhuhyeah/212957 to your computer and use it in GitHub Desktop.
Save uhhuhyeah/212957 to your computer and use it in GitHub Desktop.
# Finds videos by tags (keywords).
#
# You can use the operators +NOT+(-) and +OR+(|). For example:
# find_by_tag('cats|dogs', '-rats')
def find_by_tag(*tags)
url = "videos/-/%7Bhttp%3A%2F%2Fgdata.youtube.com%2Fschemas%2F2007%2Fkeywords.cat%7D"
keywords = tags.map{ |t| CGI::escape(t) }.join('/')
request("#{url}#{keywords}")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment