IT戦記

プログラミング、起業などについて書いているプログラマーのブログです😚

フェイスブック、ミクシィ、グリーで使われている OGP (Open Graph Protocol) とは何か

みなさん、こんにちは

お元気ですか?僕は元気です。

さて



 OGP Open Graph Protocol
OGP? 

OGP とは


 HTML 


 OGP  HTML 

なぜ、これが重要か


 SNS 
 SNS 
 SNS 使 OGP 
SNS 
OGP  SNS 使
具体的にはどう書くの?


 OGP 
<!DOCTYPE html>
<html xmlns:og="http://ogp.me/ns#">
  <head>
    <title>IT戦記 - はてなダイアリー</title>
    <meta property="og:title" content="IT戦記">
    <meta property="og:type" content="blog">
    <meta property="og:description" content="IT戦士あまちゃんが、日々思ったことやウェブのことプログラミングのことを書いている日記的なブログです。">
    <meta property="og:url" content="http://d.hatena.ne.jp/amachang/">
    <meta property="og:image" content="http://www.st-hatena.com/users/am/amachang/user.jpg">
    <meta property="og:site_name" content="はてなダイアリー">
    <meta property="og:email" content="seijro@gmail.com">
    <meta property="og:phone_number" content="080-1266-2159">
  </head>
  <body>




og:type




og:title




og:image




og:url

 URL


og:description




og:site_name




og:email, og:phone_number





The Open Graph protocol
 HTML  meta 

フェイスブックでの使われ方


使
4 OGP 使












「いいね!」した人のウォール(「いいね!」した瞬間)での OGP の使われ方


OGP 

http://callee.jp/ogp/003.html
 OGP 使


 og:title  og:site_name  property  meta 
<!DOCTYPE html>
<html xmlns:og="http://ogp.me/ns#">
  <head>
    ...
    <meta property="og:title" content="タイトルだよ">
    <meta property="og:site_name" content="サイト名だよ">
    ...
  </head>

http://callee.jp/ogp/004.html

リンクテキストの重要性

 SNS 


 og:title  og:site_name 
「シェア」した人のウォールでの OGP の使われ方


 OGP 
 URL 
http://callee.jp/ogp/007.html


 meta 
<!DOCTYPE html>
<html xmlns:og="http://ogp.me/ns#">
  <head>
    ...
    <meta property="og:title" content="おーじーぴーのテスト">
    <meta property="og:description" content="これは、あまちゃんが Open Graph Protocol の挙動を試すために用意したページです。">
    <meta property="og:image" content="http://callee.jp/ogp/full_moon.jpg">
    ...
  </head>

http://callee.jp/ogp/009.html

音声や動画を添付する方法

 OGP 使

<!DOCTYPE html>
<html xmlns:og="http://ogp.me/ns#">
  <head>
    ...
    <meta property="og:audio" content="http://callee.jp/ogp/audio.mp3">
    <meta property="og:audio:title" content="すごい歌">
    <meta property="og:audio:artist" content="すごいバンド">
    <meta property="og:audio:album" content="すごいアルバム">
    <meta property="og:audio:type" content="application/mp3" />
    ...
  </head>

http://callee.jp/ogp/015.html


<!DOCTYPE html>
<html xmlns:og="http://ogp.me/ns#">
  <head>
    ...
    <meta property="og:video" content="http://callee.jp/ogp/movie.flv">
    <meta property="og:video:width" content="450">
    <meta property="og:video:height" content="390">
    <meta property="og:video:type" content="application/x-shockwave-flash" />
    ...
  </head>


http://www.facebook.com/help/contact.php?show_form=video_embed_whitelist
「いいね!」した人のプロフィールでの OGP の使われ方

 og:type  fb:admins 
<!DOCTYPE html>
<html xmlns:og="http://ogp.me/ns#"
    xmlns:fb="http://www.facebook.com/2008/fbml">
  <head>
    ...
    <meta property="og:title" content="おーじーぴー・ザ・ムービー">
    <meta property="og:type" content="movie">
    <meta property="fb:admins" content="amachang">
    <meta property="og:image" content="http://callee.jp/ogp/amachang.gif">
    ...
  </head>

http://callee.jp/ogp/011.html
 og:type 

 fb:admins 
fb:admins 

「いいね!」した人のウォール(「いいね!」した後日)での OGP の使われ方



 fb:admins 

使



使

 og:type  article 使
 article 
fb:admins の代わりに fb:app_id を使う

fb:admins 使
 fb:admins  fb:app_id 使

Facebook for Developers | F8 Facebook: 512
ID
 fb:app_id 
<!DOCTYPE html>
<html xmlns:og="http://ogp.me/ns#"
    xmlns:fb="http://www.facebook.com/2008/fbml">
  <head>
    ...
    <meta property="og:title" content="おーじーぴー・ザ・ムービー2">
    <meta property="og:type" content="movie">
    <meta property="fb:app_id" content="168986543145706">
    <meta property="og:image" content="http://callee.jp/ogp/amachang.gif">
    ...
  </head>

http://callee.jp/ogp/012.html
 URL 
 access_token 使

# まず、アプリケーションがアプリケーション自身のリソースにアクセスするための認可を取得する
curl -F type=client_cred -F client_id=168986543145706 -F client_secret=アプリケーションの秘密鍵https://graph.facebook.com/oauth/access_token

# 次に、 URL を指定してお知らせを流す
curl -F "access_token=上のコマンドで取得できたaccess_token" -F message="Hey guys" -F id=http://callee.jp/ogp/012.html https://graph.facebook.com/feed



ミクシィやグリーでの使われ方

ミクシィやグリーでは、主に「いいね!」や「チェック」したときにストリームに流れる情報の以下の三つの指定に使われます。

プロフィールへのプッシュや、あとからお知らせを流したりする機能はないと思います(あったらすみません)

OGP のこれから


 SNS  OGP  OGP 
 OGP 
 OGP 
 Twib  URL  URL  OGP URL URL 
 URL 

と、いうわけで


 OGP Open Graph Protocol
OGP
 OGP 
 URL  OGP 
(´)