Upgrade to Pro — share decks privately, control downloads, hide ads and more …

mbedで作るニコニコ新着動画表示器

 mbedで作るニコニコ新着動画表示器

mbed + ニコニコ新検索β の検索APIを使ってニコニコ動画のカテゴリごとの新着動画を表示するデバイスを作ってみました。

444e2dcf55cc85538b065d24e10eca35?s=128

Yoshihiro MIYAI

August 30, 2014
Tweet

Transcript

  1. NCFEͰ࡞Δχίχί ৽ணಈըදࣔث NCFEࡇΓ!Նͷ౦ۜ࠲ .JB

  2. ͜Μʹͪ͸

  3. ໊લɿ.JB !NJB@ #MPHɿIUUQNJBIBUFOBCMPHKQ ࢓ࣄɿ8FCܥϓϩάϥϛϯά݉σʔλ෼ੳ झຯɿిࢠ޻࡞ͱ͔

  4. աڈ࡞඼ɿ TN TN

  5. աڈ࡞඼ɿ TN TN

  6. ࠓ೔ͷ࿩୊

  7. NCFE͔ΒΠϯλʔωοτ্ͷ σʔλΛऔಘͯ͠දࣔ

  8. ࡞ͬͨ΋ͷ

  9. NCFEͰχίχίͷΧςΰϦ͝ͱͷ ৽ணಈըΛϦΞϧλΠϜʹදࣔ͢ΔσόΠε

  10. શମͷߏ੒

  11. $ 3VCZ  4JOBUSB IUUQTXXXIFSPLVDPN IUUQTFBSDIOJDPWJEFPKQ χίχί ৽ݕࡧЌ NCFE )FSPLV

    )551 )551
  12. ֤ߏ੒ཁૉʹ͍ͭͯ

  13. χίχί৽ݕࡧЌ

  14. χίχί৽ݕࡧЌɿ OJDPOJDPͷτοϓϖʔδͷӈ্ͷํ

  15. χίχί৽ݕࡧЌɿ

  16. χίχί৽ݕࡧЌɿ ΧςΰϦλά͔Β࠷৽ͷ ౤ߘಈը৘ใΛऔಘ

  17. w ϦΞϧλΠϜʹ൓ө w ݕࡧ"1*ͷఏڙ χίχί৽ݕࡧЌಛ௃ɿ

  18. ϦΞϧλΠϜʹ ৽ن౤ߘಈըΛ දࣔ͢ΔσόΠε͕ ࡞ΕΔʂ

  19. )FSPLV

  20. )FSPLVɿ 1BB4 1MBUGPSNBTB4FSWJDF  ! ੲ͔Β͋ΔϨϯλϧαʔόʔͷ ݱ୅൛ͱ͍ͬͨײ͡

  21. )FSPLVɿ w ݕࡧ"1*͔Βಈը৘ใऔಘ w จࣈίʔυͷม׵ w දࣔ༻ʹจࣈྻՃ޻

  22. ͳͥ)FSPLVܦ༝ɿ จࣈྻॲཧͰָ͢ΔͨΊ NCFE෦෼͸൚༻తʹ

  23. )FSPLVͷϓϩάϥϜɿ IUUQTHJUIVCDPNNJB OJDPWJEFP@DBUFHPSZ@SFDFOU@WJEFPT@BQJ

  24. NCFE

  25. NCFEɿ ϥϐουϓϩτλΠϐϯά༻ͷ ϚΠίϯϘʔυ ࣅͨ΋ͷʹ"SEVJOP͕͋Δ

  26. "SEVJOPͱൺֱɿ Πʔαωοτͷ෺ཧ૚͕ νοϓʹࡌ͍ͬͯΔ

  27. "SEVJOPͱൺֱɿ ίωΫλΛ͚ͭΔ͚ͩͰ ωοτϫʔΫʹ઀ଓͰ͖Δ

  28. "SEVJOPͱൺֱɿ ωοτϫʔΫʹͭͳ͙࣌ͷ τʔλϧͰͷՁ͕͍֨҆

  29. "SEVJOPͱൺֱɿ "SEVJOP6OP Πʔαωοτ γʔϧυ໿ԁ NCFE-1$ Πʔαωοτ ઀ଓΩοτ໿ԁ εΠοναΠΤϯε͞ΜͷՁ֨Λࢀߟʹࢉग़

  30. ͱ͍͏͜ͱͰNCFE Λબͼ·ͨ͠

  31. NCFEɿ )FSPLV͔Βσʔλͷऔಘ ༗ػ&-Ϟδϡʔϧ΁දࣔ

  32. NCFEͷϓϩάϥϜɿ IUUQTHJTUHJUIVCDPN NJBCGCBGFG your-app.heroku.com ͷ෦෼͚ͩॻ͖׵͍͑ͯͩ͘͞

  33. ༗ػ&-Ϟδϡʔϧ

  34. ༗ػ&- 0-&% Ϟδϡʔϧɿ 4&-#Λ࢖͏ IUUQTTUSBXCFSSZMJOVYDPNDBUBMPHJUFNT DPEF

  35. ༗ػ&- 0-&% Ϟδϡʔϧɿ NCFE༻ͷϥΠϒϥϦ͕͢Ͱʹ͋Δ (SBQIJD0-&% IUUQNCFEPSHVTFSTWBOPUFCPPLHSBQIJDPMFE

  36. ༗ػ&- 0-&% Ϟδϡʔϧɿ ೔ຊޠ༻ϑΥϯτͷඒ࡙ϑΥϯτ͕ ૊Έࠐ·Ε͍ͯΔ +*4ୈҰɾୈೋਫ४ͷ׽ࣈΛαϙʔτ

  37. ༗ػ&- 0-&% Ϟδϡʔϧɿ

  38. 8FC"1*ͷར༻

  39. χίχί৽ݕࡧЌɿ IUUQTFBSDIOJDPWJEFPKQEPDTBQJDPOUFTUIUNM +40/ܗࣜͷσʔλΛૹΕͱॻ͍ͯ͋Δ

  40. +40/ʁ

  41. 8FC"1*ͰΑ͘࢖ΘΕΔσʔλϑΥʔϚοτ { "query" : "χίχίٕज़෦", "service" : ["video"], "search" :

    ["tags"], "join" : ["cmsid", "title", "start_time"], "from" : 0, "size" : 1, "sort_by" : "start_time", "order" : "desc", "issuer" : "apiguide", "reason" : "mbed festival" } +40/ +BWB4DSJQU0CKFDU/PUBUJPO
  42. w จࣈྻɿzŚŐŐŐŐƃųƄŕŪƄz w ਺஋ɿ w ਅِ஋ɿUSVF GBMTF ࢖͑Δܕɿ

  43. w ഑ྻɿ
 <TN TN lTN> w ࿈૝഑ྻɿ
 \lUJUMFzlNCFEz lDNTJEzlTNz^ ࢖͑Δܕɿ

  44. ઌ΄Ͳͷ+40/ɿ { "query" : "χίχίٕज़෦", "service" : ["video"], "search" :

    ["tags"], "join" : ["cmsid", "title", "start_time"], "from" : 0, "size" : 1, "sort_by" : "start_time", "order" : "desc", "issuer" : "apiguide", "reason" : "mbed festival" } શମ͸ෳ਺ͷΩʔΛ΋ͭ࿈૝഑ྻ
  45. {“query":“χίχίٕज़෦”, .. } RVFSZͱ͍͏ΩʔͰʮχίχίٕज़෦ʯ ͱ͍͏จࣈྻΛ࣋ͭ ઌ΄Ͳͷ+40/ɿ

  46. {..,"join":["cmsid","title",“start_time"],..} KPJOͱ͍͏ΩʔʹߋʹจࣈྻΛཁૉ ͱ͢Δ഑ྻΛ࣋ͭ ઌ΄Ͳͷ+40/ɿ

  47. )FSPLV΁ͷ ΞΫηε

  48. ϒϥ΢βͰΞΫηεɿ TNcšƃŲƅſcαϯϓϧϦΫΤετ ҎԼͷจࣈྻ͕ฦͬͯ͘Δ͚ͩͷΞϓϦέʔγϣϯ

  49. ΫϥΠΞϯτ͔ΒϦΫΤετϝοηʔδ ͷߏஙɾૹ৴ ଴ػ αʔόʔ͔ΒϨεϙϯεϝοηʔδ ͷड৴ɾղੳ )551 )ZQFSUFYU5SBOTGFS1SPUPDPM ͷྲྀΕɿ

  50. GET / HTTP/1.1 User-Agent: curl/7.30.0 Host: your-app.herokuapp.com Accept: */* Connection:

    close ϦΫΤετ ϔομ )551Ͱ͸)PTU͕ඞਢ )551ϝιουϦΫΤετύεϓϩτίϧόʔδϣϯ ϦΫΤετϝοηʔδɿ
  51. HTTP/1.1 200 OK Content-Type: text/html;charset=Shift_JIS Content-Length: 28 Server: WEBrick/1.3.1 (Ruby/2.0.0/2014-05-08)

    Date: Sat, 30 Aug 2014 00:55:14 GMT Via: 1.1 vegur ! sm0|šƃŲƅſ|αϯϓϧϦΫΤετ ϓϩτίϧόʔδϣϯεςʔλείʔυϝοηʔδ Ϩεϙϯεϔομʔ ϨεϙϯεϘσΟ Ϩεϙϯεϝοηʔδɿ
  52. NCFE͔Β)FSPLV ΁ΞΫηε

  53. NCFEP⒏DJBMͷϓϩάϥϜɿ IUUQTNCFEPSHVTFSTNCFE@P⒏DJBMDPEF 5$14PDLFU@)FMMP8PSMEEPDTEDFGEEB NBJO@DQQ@TPVSDFIUNM ʙߦ໨ɿ sock.connect("mbed.org", 80); ! char http_cmd[]

    = "GET /media/ uploads/mbed_official/hello.txt HTTP/ 1.0\n\n";
  54. NCFEP⒏DJBMͷϓϩάϥϜɿ ʙߦ໨ɿ sock.connect("mbed.org", 80); ! char http_cmd[] = "GET /media/uploads/

    mbed_official/hello.txt HTTP/1.0\n\n"; sock.connect(“your-app.heroku.com”, 80); ! char http_cmd[] = "GET / HTTP/1.1\r \nHost: your_app.herokuapp.com\r \nConnection: close\r\n\r\n";
  55. NCFEP⒏DJBMͷϓϩάϥϜɿ HTTP/1.1 200 OK Content-Type: text/html;charset=utf-8 Date: Tue, 15 Jul

    2014 16:25:58 GMT Server: WEBrick/1.3.1 (Ruby/ 2.0.0/2014-05-08) Content-Length: 28 Connection: Close ! sm0|šƃŲƅſ|αϯϓϧϦΫΤετ Ϩεϙϯεɿ
  56. ·ͱΊ

  57. w ެࣜͷϥΠϒϥϦ͚ͩͰωοτϫʔΫ
 ͔ΒσʔλΛऔಘͰ͖ΔͷͰָ w χίχί৽ݕࡧЌ"1*͸ϦΞϧλΠϜੑ
 ͕ߴ͍ͷͰσόΠεͰ࢖͍΍͍͢ ·ͱΊɿ

  58. w ಉ໊ͷϥΠϒϥϦ͕͋ͬͯ໎͏ IUUQDMJFOUͱ͔  w (JUIVC࿈ܞ͍ͨ͠ ࠔͬͨͱ͜Ζɿ

  59. None