2015-11-01

Twiccaのツイート表示アクションでプラグインに渡されるIntentのExtraの例

a. Twiccaのツイート表示アクションについて

ツイート表示アクション | Developers | twicca - Yet another Twitter client for Android.

b. Twiccaで開くツイートの例

Finding new worlds with a play of light & shadow can tell us about systems like our own: http://go.nasa.gov/1Q0aJF9 - Twitter / NASA

c. bに対してTwiccaのツイート表示アクションが発生した時にプラグインに渡されるIntentのExtra

android.intent.extra.TEXT=Finding new worlds with a play of light & shadow can tell us about systems like our own: https://t.co/zX0YzJuhnX https://t.co/LB6f55po2W
id=660176856839245824
latitude=null
longitude=null
created_at=1446233402953
source=Sprinklr
in_reply_to_status_id=null
user_screen_name=NASA
user_name=NASA
user_id=null
user_profile_image_url=http://pbs.twimg.com/profile_images/188302352/nasalogo_twitter.jpg
user_profile_image_url_mini=http://pbs.twimg.com/profile_images/188302352/nasalogo_twitter_mini.jpg
user_profile_image_url_normal=http://pbs.twimg.com/profile_images/188302352/nasalogo_twitter_normal.jpg
user_profile_image_url_bigger=http://pbs.twimg.com/profile_images/188302352/nasalogo_twitter_bigger.jpg

d. cを見た結果、ツイート表示アクションを使うプラグインを作成する際に注意すべきこと

  1. 短縮URLの展開やハッシュタグの抽出をしたい場合、プラグイン側がツイート本文の解析処理を実装する必要がある。
  2. 特に短縮URLは https://t.co/{7つの数字または文字} という形式なので、展開してみないとリソースの種類(添付画像、外部サイト等)すら判断できない。
  3. 添付画像の短縮URLは https://twitter.com/{user_screen_name}/status/{id}/photo/1 の単一ツイート表示ページに転送される。この点だけで判断すると、ツイート本文から添付画像の実際のURLを抽出したい場合は、短縮URLの展開に加えて /photo/1 で終わるURLのWebページ(か、単一ツイートの表示ページ)から目的の画像のファイル名を見つけ出す処理が必要となる。
  4. ツイート自体を指すURLはExtraに入っていないが、代わりにuser_screen_nameとidを使って https://twitter.com/{user_screen_name}/status/{id} あるいは https://twitter.com/statuses/{id} という形式でツイートのURLを作成できる。

0 件のコメント:

コメントを投稿