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

oEmbed と Text::Hatena

oEmbed と Text::Hatena

Yasuhiro Onishi

March 18, 2012
Tweet

More Decks by Yasuhiro Onishi

Other Decks in Programming

Transcript

  1. P&NCFEͱ5FYU)BUFOB

    JEPOJTIJ
    גࣜձࣾ͸ͯͳେ੢߁༟

    View full-size slide

  2. ࣗݾ঺հ
    wJEPOJTIJେ੢߁༟
    wגࣜձࣾ͸ͯͳ
    wνʔϑΤϯδχΞ
    w͸ͯͳμΠΞϦʔϒϩάσΟϨΫλʔ
    w%FWFM,:51SPG
    w5FYU)BUFOB
    wਖ਼نදݱ͚ͩͰԿͱ͔͠Α͏ͱ͗͢͠Δ

    View full-size slide

  3. ಈըຒΊࠐΈ

    View full-size slide

  4. ຒΊࠐΈλά

    View full-size slide

  5. ͸ͯͳه๏
    [http://www.youtube.com/watch?v=XDB9-­‐TUrzc0:movie]

    View full-size slide

  6. ͦͷ࣮૷
    wಈըαʔϏεຖʹݸผରԠ
    wਖ਼نදݱ΋Γͩ͘͞Μ
    wαΠτͷมߋʹ௥ै͢Δͷ͍ͨ΁Μ
    wNPWJFJNBHFTPVOE

    View full-size slide

  7. P&NCFE
    w63-ຒΊࠐΈ࢓༷
    wࣸਅ΍ಈըίϯςϯπΛαʔυύʔ
    ςΟʹຒΊࠐΉͨΊͷ"1*
    wIUUQPFNCFEDPN

    View full-size slide

  8. P&NCFETQFD
    w63-TDIFNF
    w"1*FOEQPJOU
    http://www.flickr.com/photos/*
    http://www.flickr.com/services/oembed/

    View full-size slide

  9. P&NCFESFRVFTU
    wVSM
    wNBYXJEUI PQUJPOBM

    wNBYIFJHIU PQUJPOBM

    wGPSNBU PQUJPOBM
    +40/PS9.-

    View full-size slide

  10. P&NCFESFTQPOTF
    {
           "version":  "1.0",
           "type":  "photo",
           "width":  240,
           "height":  160,
           "title":  "ZB8T0193",
           "url":  "http://farm4.static.flickr.com/3123/2341623661_7c99f48bbf_m.jpg",
           "author_name":  "Bees",
           "author_url":  "http://www.flickr.com/photos/bees/",
           "provider_name":  "Flickr",
           "provider_url":  "http://www.flickr.com/"
    }

    View full-size slide

  11. 8FCP&NCFE
    IUUQTNFUBDQBOPSHNPEVMF8FCP&NCFE
    use  Web::oEmbed;
    my  $consumer  =  Web::oEmbed-­‐>new({
           format  =>  'json'
    });
    $consumer-­‐>register_provider({
           url    =>  'http://*.flickr.com/*',
           api    =>  'http://www.flickr.com/services/oembed/',
    });
    my  $response  =  $consumer-­‐>embed("http://
    www.flickr.com/...");
    print  $response-­‐>render;  #=>  

    View full-size slide

  12. P&NCFEQSPWJEFS

    View full-size slide

  13. P&NCFEEJTDPWFSZ
       href="http://flickr.com/services/oembed?url=...&format=json"
           title="..."  />
       href="http://flickr.com/services/oembed?url=...&format=xml"
           title="..."  />

    View full-size slide

  14. 5FYU)BUFOB&NCFE
    [http://www.youtube.com/watch?v=XDB9-­‐TUrzc0:embed]

    View full-size slide

  15. w8FCP&NCFEʹϓϩόΠμΛϓϦηοτ
    wFOEQPJOU"VUP%JTDPWFS
    5FYU)BUFOB&NCFE

    View full-size slide

  16. ϦΫΤετͨ͘͠ͳ͍

       src="http://www.youtube.com/embed/$VIDEO_ID">

    View full-size slide

  17. wఆٛࡁͷม׵Λਖ਼نදݱͰߦ͏
    w8FCP&NCFEʹϓϩόΠμΛϓϦηοτ
    wFOEQPJOU"VUP%JTDPWFS
    5FYU)BUFOB&NCFE

    View full-size slide

  18. JOTUBHSBNషΕ΁Μͷʁ

    View full-size slide

  19. P&NCFEඇରԠαΠτ
    wࣸਅڞ༗αΠτͰ΋P&NCFEରԠαΠ
    τ͸গͳ͍
    wP&NCFEʹ͸ରԠ͍ͯ͠ͳͯ͘΋ΞϨ
    ʹରԠ͍ͯ͠Δʂʂ

    View full-size slide

  20. wఆٛࡁͷม׵Λਖ਼نදݱͰߦ͏
    w8FCP&NCFEʹϓϩόΠμΛϓϦηοτ
    wFOEQPJOU"VUP%JTDPWFS
    wPHJNBHFΛऔಘͯ͠ը૾λάΛग़ྗ
    5FYU)BUFOB&NCFE

    View full-size slide

  21. 5FYU)BUFOB&NCFE
    IUUQTHJUIVCDPNPOJTIJ5FYU)BUFOB&NCFE
    my  $embed  =  Text::Hatena::Embed-­‐>new;
    print  $embed-­‐>render($url);

    View full-size slide

  22. ·ͱΊ
    wP&NCFE΂ΜΓ
    w΂ΜΓϞδϡʔϧެ։͠·ͨ͠ʔ
    w&NCFE΋ؚΜͩ5FYU)BUFOBϑϧηοτ
    ࠷৽൛Λࠓय़ϦϦʔε༧ఆ
    w͍ͭͰʹ͸ͯͳϒϩά΋ਖ਼ࣜԽ

    View full-size slide

  23. ͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠

    View full-size slide