• 沒有找到結果。

第三章 系統設計與架構

3.2 系統設計理念

3.2.1 動態消息資料格式分析

於 Facebook 資料庫裡各類重要的物件,「links」、「posts」、「statuses」,「feed」等,

因此取得粉絲頁動態消息物件資料即可達成本研究資料蒐集目標。

緊接著我們要了解動態消息物件包含了哪些可用資料欄位,才能在我們資料 庫中建立相對應的資料表以儲存相對應之資料內容。Facebook 所公布的動態消

25

息物件欄位資訊如下表 3-1,Facebook 說明文件所公布的欄位資料中僅包含該物 件主要的欄位資料,但在實際蒐集資料的過程中仍需注意其他如發佈者資料、發 布時間、更新時間等通用性資料。

表3- 1「feed」物件欄位資料表 引用來源:

https://developers.facebook.com/docs/graph-api/reference/v2.3/page/feed/

名稱 描述 型態

message The main body of the post, otherwise called the status message. Either link, place, or message must be supplied.

string

link The URL of a link to attach to the post.

Either link,place, or message must be supplied.

Additional fields associated with link are shown below.

string

actions The action links attached to the post. Action links are any other links shown below the feed story

beside Likeand Comment.

object[]

place Page ID of a location associated with this post.

Eitherlink, place, or message must be supplied.

string

tags Comma-separated list of user IDs of people tagged in this post. You cannot specify this field without also specifying a place.

csv[string]

object_attachment Facebook ID for an existing picture in the person's photo albums to use as the thumbnail image. They must be the owner of the photo, and the photo cannot be part of a message attachment.

string

targeting Object that limits the audience for this content. Anyone not in these demographics will not be able to view this content. This will not override any Page-level

demographic restrictions that may be in place.

object

26

countries Values of targeting countries. You can specify up to 25 countries. Use ISO 3166 format codes.

string

locales Targeted locales. Use type of allocale to find Targeting Options and use the returned key to specify.

int[]

regions Values for targeted regions. You may specify up to 200 regions.

list<unsigned int32>

cities Values for excluded cities. Use type of adcity to find Targeting Options and use the returned key to specify.

list<unsigned int32>

feed_targeting Object that controls news feed targeting for this content.

Anyone in these groups will be more likely to see this content, those not will be less likely, but may still see it anyway. Any of the targeting fields shown here can be used, none are required.

object

published Whether a story is shown about this newly published object. Default is true which means the story is displayed in News Feed. This field is not supported when actions parameter is specified. Unpublished posts can be used in ads.

bool

scheduled_publish_time Time when this post should go live, this can be any date between ten minutes and six months from the time of the API call.

timestamp

backdated_time Specifies a time in the past to back-date this post to. timestamp

backdated_time_granularity Controls the display of how a backdated post appears.

For example, if you pick month posts will be displayed as 2 months ago. instead of an exact date.

enum{year, month, day, hour, minute}

child_attachments Use to specify multiple links in the post. Minimum 2 and maximum of 5 objects. If you set

multi_share_optimized to true, you can upload a maximum of 10 objects but Facebook will display the

array of link objects

27

‧ 國

立 政 治 大 學

N a tio na

l C h engchi U ni ve rs it y

top 5

multi_share_optimized If set to true and only when the post is used in an ad, Facebook will automatically select the order of links in child_attachments. Otherwise, the original ordering of child_attachments is preserved. Default value is true.

boolean

在了解到我們所要蒐集的動態消息資料(feed)的欄位後,Facebook 會以哪種 資料格式透過 Graph API 回傳資料給我們?在 Facebook 說明文件中提到 Graph API 會以 JSON 格式回傳所需的資料,所以在接收到資料時會收到如下圖 3-5 JSON 格式接收資料內容,要正確的解讀 JSON 格式資料內容,我們需要再使用 專用的解析工具加以整理才能辨識其內容,其整理後的資料如下圖 3-6。另外在 實際解析 Graph API 所回傳之 JSON 格式資料時,需注意各式標籤及格式的對應,

以避免發生資料解析上的錯誤。

28

‧ 國

立 政 治 大 學

N a tio na

l C h engchi U ni ve rs it y

圖3- 5 JSON 格式原始資料範例

29

‧ 國

立 政 治 大 學

N a tio na

l C h engchi U ni ve rs it y

圖3- 6 JSON 格式已解析資料範例

經由解析動態消息資料後,因本研究主要使用 posts 資料作為貼文分享推導 使用。在了解其相關欄位定義後,我們發現到當 status_type 為 shared_story;story 為非空值;且 story 欄位含有 shared 字樣時即為貼文分享的情形,如下圖

3-7 ”Taiwan Association for Human Rights 台灣人權促進會分享了 g0v.tw 台灣零時 政府的貼文”。

30

‧ 國

立 政 治 大 學

N a tio na

l C h engchi U ni ve rs it y

圖3- 7 posts 資料欄位分析示意圖