Created
March 5, 2015 20:16
-
-
Save ydn/0095fead03012ff982f2 to your computer and use it in GitHub Desktop.
Flickr API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
var yqlCallback = function(data) { | |
console.log(data); | |
var photo = data.query.results.photo[0]; | |
alert(photo.title); | |
}; | |
</script> | |
<script src="https://query.yahooapis.com/v1/public/yql?q=select * from flickr.photos.search where has_geo='true' and tags='New York City' and api_key='YOUR KEY'&format=json&callback=yqlCallback"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Download the following GitHub repository https://github.com/guilhermechapiewski/yql-ios | |
// Copy the yql-ios folder to your project | |
#import "YQL.h"; | |
yql = [[YQL alloc] init]; | |
NSString *queryString = @"select * from flickr.photos.search where has_geo="true" and text="london,UK" and api_key="<your API Key>"; | |
NSDictionary *results = [yql query:queryString]; | |
NSLog(@"%@",results[@"query"][@"count"]); | |
NSLog(@"%@",results[@"query"][@"results"]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$BASE_URL = "https://query.yahooapis.com/v1/public/yql"; | |
$yql_query = 'select * from flickr.photos.search where has_geo="true" and text="london,UK" and api_key="<your API Key>"'; | |
$yql_query_url = $BASE_URL . "?q=" . urlencode($yql_query) . "&format=json"; | |
// Make call with cURL | |
$session = curl_init($yql_query_url); | |
curl_setopt($session, CURLOPT_RETURNTRANSFER,true); | |
$json = curl_exec($session); | |
// Convert JSON to PHP object$phpObj = json_decode($json); | |
var_dump($phpObj); | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib2, urllib, json | |
baseurl = "https://query.yahooapis.com/v1/public/yql?" | |
yql_query = 'select * from flickr.photos.search where has_geo="true" and text="london,UK" and api_key="<your API Key>"' | |
yql_url = baseurl + urllib.urlencode({'q':yql_query}) + "&format=json" | |
result = urllib2.urlopen(yql_url).read() | |
data = json.loads(result) | |
print data['query']['results'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var YQL = require('yql'); | |
var query = new YQL('select * from flickr.photos.search where has_geo="true" and tags="New York City" and api_key="YOUR KEY"', { ssl: true }); | |
query.exec(function(err, data) { | |
var photo = data.query.results.photo[0]; | |
console.log(photo.title); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment