Skip to content

Instantly share code, notes, and snippets.

@lipelopeslage
Last active January 31, 2016 18:12
Show Gist options
  • Save lipelopeslage/1f0016053c5219e59de6 to your computer and use it in GitHub Desktop.
Save lipelopeslage/1f0016053c5219e59de6 to your computer and use it in GitHub Desktop.
Freebase AJAX sitcom query
var query = [{
"type": "/tv/tv_program",
"name": null,
"id": null,
"genre": "sitcom",
"/common/topic/image": [{
"id": null
}],
"/common/topic/subjects": [],
"program_creator": [],
"number_of_episodes": [],
"number_of_seasons": [],
"/common/topic/official_website": [],
"episodes": [],
"air_date_of_first_episode": [],
"air_date_of_final_episode": [],
"country_of_origin": []
}],
params = {"query":JSON.stringify(query)},
service_url = "https://www.googleapis.com/freebase/v1/mqlread",
url = service_url + '?callback=?';
$.getJSON(url, params, function(response){
/*var res = response.result, pDOM = $("p.result"), item;
for(var i in res){
item = res[i];
pDOM.append(item.name+":<br>- "+item.number_of_episodes+" episódios<br>- "+item.number_of_seasons+" temporadas<br>- Gênero: "+item.genre.join(", ")+"<br>- Data do primeiro episódio: "+item.air_date_of_first_episode+"<br>- Data do último episódio: "+item.air_date_of_final_episode+"<br>- País de origem: "+item.country_of_origin+"<br><br>");
}*/
console.log(response);
},"json");
//PEGAR DESCRICAO DA SERIE: https://www.googleapis.com/freebase/v1/topic/m/07q37w?filter=/common/topic/description
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment