Skip to content

Instantly share code, notes, and snippets.

@chrisallick
Created February 1, 2013 20:36
Show Gist options
  • Save chrisallick/4693962 to your computer and use it in GitHub Desktop.
Save chrisallick/4693962 to your computer and use it in GitHub Desktop.
How day do dat? Pulling vine videos from twitter based on a hashtag. create the json request, bump the script tag with object into your dom, delete dom element, parse it.
result.entities.urls[0].expanded_urlfetch = function(query) {
var script_tag = document.createElement("script");
script_tag.id = "fetcher";
script_tag.src = "https://search.twitter.com/search.json"+query+"&callback=parse";
document.body.appendChild(script_tag);
}
parse = function(data) {
document.body.removeChild(document.getElementById("fetcher"));
if( data && data.results ) {
for( var i = 0, len = data.results.length; i < len; i++ ) {
var result = data.results[i];
if( result.entities.urls[0].display_url ) {
if( result.entities.urls[0].expanded_url.indexOf("http://vine.co/v/") != -1 ) {
console.log( result.entities.urls[0].expanded_url );
vine_urls.push( result.entities.urls[0].expanded_url );
}
}
}
}
}
var vine_urls = new Array();
$(document).ready(function() {
fetch("?q=vine.co%2Fv%2F&result_type=recent&include_entities=1&rpp=20");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment