YDN KR Tech Talk : Pipes 와 YQL 활용하기

2,292
-1

Published on

멋진 웹 Apps위해 필요한 것들
그런데 삽질은 하고 싶지 않아요!
Pipes : Data의 수집과 가공을 한방에!
YQL : Pipes를 개선, SQL 형식의 웹 데이터 처리 도구
“더 많이 나누어 줄 수록 더 좋은 일이 생겼습니다”

Published in: Technology, Design
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,292
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
15
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

YDN KR Tech Talk : Pipes 와 YQL 활용하기

  1. 1. Y!Pipes & YQL Yahoo! Developer Network 2009.08.25
  2. 2. • – Technical Evangelist – YDN KR Blog ‣ ydnkrblog.com – YDN KR Twitter ‣ twitter.com/ydnkr • – phpschool.com (’98~05, 8 ) – lovesera.com (2001 ~) – Twitter, @phploveme
  3. 3. Apps 1 2 3 Open API PHP Flash RSS, ASP Silverlight XML JSP CSS/JS HTML YUI
  4. 4. ! var map = new YMap(document.getElementById('map')); ? … var currentGeoPoint = new YGeoPoint( _c.Lat, _c.Lon ); map.addMarker(currentGeoPoint); … ? … if (flickcurl_prepare(fc, "flickr.photos.geo.correctLocation", parameters, count)) { … } … http://search.yahooapis.com/ ImageSearchService/V1/imageSearch? ? appid=YahooDemo&query=Corvette&results= ? 2 http://weather.yahooapis.com/ forecastrss?p=FRXX0076&u=c
  5. 5. YQL YQL SELECT * FROM Internet
  6. 6. Data !
  7. 7. Pipes NHN RSS DAUM JSON Yahoo! Flash Silverlight HTML CSS/JS YUI MS PHP Web Data Badge
  8. 8. Y!Pipes Library Canvas Help Debugger
  9. 9. Output http://pipes.yahoo.com/phploveme/yuiyql
  10. 10. Widget
  11. 11. DEMO : Daum + Naver Blog pipes.yahoo.com/phploveme/yuiyql
  12. 12. Yahoo Pipes • DEMO Pipes URL – http://pipes.yahoo.com/phploveme/yuiyql • Daum Blog URL – http://apis.daum.net/search/blog?apikey=[APIKEY]&q= • Naver Blog URL – http://openapi.naver.com/search?key=[APIKEY]&target=blog&query= • –  User Input - Text Input – URL  Url - URL Builder  String - Private String  Source - Fetch Feed –  Operator - Union  Operator - Sort
  13. 13. Pipes • • • Access • •
  14. 14. YQL developer.yahoo.com/yql
  15. 15. Yahoo! Query Language • – social, flickr, geo, local, weather – mybloglog, search, upcoming, yahoo – HTML, RSS, XML, JSON, CSV + Community Open Data Table(177)
  16. 16. Yahoo!
  17. 17. YQL : social.profile select * from social.profile where guid=me
  18. 18. flickr :
  19. 19. YQL : flickr.photos.search
  20. 20. RSS select * from rss where url='http://ydnkrblog.com/blog/?feed=rss2'
  21. 21. IP/ select * from ip.location where ip='222.122.195.6'
  22. 22. select * from twitter.user.status where id='ydnkr'
  23. 23. YQL : Flickr Search
  24. 24. YQL : Flickr Photo Widget , yql-image.php <?php $yql = "select * from flickr.photos.search where safe_search='true' and text='yahoo korea'"; $uri = "http://query.yahooapis.com/v1/public/yql? q=".urlencode($yql)."&format=xml"; $sxml = simplexml_load_file($uri); header('Content-Type: text/html; charset=utf-8'); foreach($sxml->results->photo as $photo){ $uri = 'http://farm' .$photo['farm'] .'.static.flickr.com/' .$photo['server'].'/' .$photo['id'].'_' .$photo['secret'] .'_m.jpg'; $html[] = $photo['title'].'<br/>'; $html[] = '<img src="'.$uri.'"/><br/>'; } echo implode("n", $html); ?>
  25. 25. http://sandbox.jemr.net/yql-image.php Source : http://sandbox.jemr.net/yql-image.phps
  26. 26. + YUI http://sandbox.jemr.net/yql-image-yui.php ,http://sandbox.jemr.net/yql-image-yui.phps
  27. 27. Insert / Update / Delete • • Remote Web Service – , • Open Data Table use ‘http://mysite.com/table.xml’ as tableName; select * from tableName where key=‘value’...
  28. 28. Twitter Insert 3 • 1. Open Data Table (XML) – Ex: http://sandbox.jemr.net/yql-twitter-status.xml • 2. YQL use "http://sandbox.jemr.net/yql-twitter-status.xml" as table; insert into table (username, password, status) values('yqltesting','****','YQL-Twitter Test !!! '); • 3. Twitter
  29. 29. 1. Open Data Table yql-twitter-status.xml <?xml version="1.0" encoding="UTF-8"?> <table xmlns="http://query.yahooapis.com/v1/schema/table.xsd"> <meta> <sampleQuery>select * from {table}</sampleQuery> </meta> <bindings> <select itemPath="" produces="XML"> <urls><url>http://twitter.com/statuses/show/{id}.xml</url></urls> <inputs> <key id="username" type="xs:string" required="false" paramType="variable" /> <key id="id" type="xs:string" required="false" paramType="path" /> </inputs> <execute><![CDATA[ var r = null; if (username) { var query = y.query('select * from twitter.user.timeline where id="'+username+'";'); var result = <twitter/>; for each (var twit in query.results.entry) { result.appendChild(twit); } response.object = result; } else { r = request.get().response; response.object = r; } ]]></execute> </select> <insert itemPath="" produces="XML"> <urls><url>http://twitter.com/statuses/update.xml</url></urls> <inputs> <key id="username" type="xs:string" required="true" paramType="variable" /> <key id="password" type="xs:string" required="true" paramType="variable" /> <key id="status" type="xs:string" required="true" paramType="variable" /> </inputs> <execute><![CDATA[ var r = null; y.include("http://yqlblog.net/samples/base64.js"); var authheader = "Basic " + Base64.encode(username+":"+password); var content = "status="+status; r = request.header("Authorization", authheader).post(content).response; response.object = r; ]]></execute> </insert> <delete itemPath="" produces="XML"> <urls><url>http://twitter.com/statuses/destroy/{updateid}.xml</url></urls> <inputs> <key id="username" type="xs:string" required="true" paramType="variable" /> <key id="password" type="xs:string" required="true" paramType="variable" /> <key id="updateid" type="xs:string" required="true" paramType="path" /> </inputs> <execute><![CDATA[ var r = null; y.include("http://yqlblog.net/samples/base64.js"); var authheader = "Basic " + Base64.encode(username+":"+password); response.object = request.header("Authorization", authheader).del().response; ]]></execute> </delete> </bindings> </table>
  30. 30. 2. INSERT into Twitter use "http://sandbox.jemr.net/yql-twitter-status.xml" as table; insert into table (username, password, status) values('yqltesting','***','YQL-Twitter Test !!! ');
  31. 31. 3. Twitter http://twitter.com/yqltesting
  32. 32. (177) http://www.slideshare.net/phploveme/ignite-seoul-intro
  33. 33. : Slideshare.net select * from slideshare.transcript where url="http://www.slideshare.net/phploveme/ignite-seoul-intro"
  34. 34. • YQL – – – Syntax – Interactive • – parallel requests – Request / Data Size :
  35. 35. Community Open Data Table http://datatables.org/
  36. 36. Evan Williams,@ev
  37. 37. Thanks Developer.yahoo.com ydnkrblog.com

×