概要
- Twitter 公式Web で {{ }} に囲まれたツイートが見えないと話題になる。
- {{ }}の中に色々入れて遊ぶひとがでる
- どうやらキーワードによっては文字が展開されるらしい
- 公式Webが完膚なきまでに破壊され、みんな遊びつくす
多分こういうこと
公式Webはテキストの整形にmustache を使っていて、これが JavaScript によって1一段階2展開される。JavaScriptをその中で実行することは出来ない模様。
整形に使われるデータは、恐らくREST API の /statuses/show とか
Streaming API で流れてくる JSON のデータと同じ。つまり、ここの返値の内容で遊べる。
これがわかるのは何故かと云うと、
{{ user.screen_name }}
は展開されるのに
{{ user.status.text }}
などは展開されないから。
これを使えば、 bio を140文字以上に設定してあれば
{{user.description}}
でWeb上では140文字を越えているように見えるついーととかが出来たりする。あとは
{{user.created_at}}
とかで自分がついったー初めた日とかわかる。
{{ retweet_count }}
とかを使うとリツイートされる度に数が増えたりする。mustacheの制御構造を使えば、リツイートの有無などによって表示内容を変えることも出来る。実際に
@necocen さんがやってたりする。
使えそうなパラメタを一応下に挙げておきます。配列型は
{{#配列型}}子要素名{{/配列型}}
とかやると各要素ごとに展開出来る。存在しない場合の処理は
# を ^
に変えたりするとよいみたいだけどたしかめてない(necocenさんはこれつかってた)。{{#hoge}}は、ハッシュタグとの兼ね合いで上手くいったりいかなかったりするもよう。
気をつける点としては、img
とかを出してきても文字列として展開されるだけで、画像が埋め込まれたりはしない。
使えそうなデータ一覧
インデントされてるのは適宜 .
で繋げるなりイテレートするなりして取り出してください。
- in_reply_to_screen_name
- id_str
- in_reply_to_status_id
- user
- lang
- time_zone
- screen_name
- id_str
- profile_image_url
- geo_enabled
- default_profile_image
- name
- verified
- description
- profile_background_image_url
- profile_link_color
- following
- profile_background_tile
- show_all_inline_media
- utc_offset
- profile_image_url_https
- profile_background_image_url_https
- friends_count
- location
- id
- profile_sidebar_fill_color
- follow_request_sent
- listed_count
- default_profile
- profile_sidebar_border_color
- notifications
- statuses_count
- favourites_count
- profile_use_background_image
- followers_count
- profile_background_color
- url
- profile_text_color
- is_translator
- created_at
- contributors_enabled
- protected
- retweeted
- coordinates
- contributors
- favorited
- in_reply_to_user_id
- possibly_sensitive
- text
- entities
- user_mentions (配列)
- screen_name
- id_str
- name
- id
- indices (配列)
- hashtags (配列)
- text
- indices (配列)
- urls (配列)
- expanded_url
- indices (配列)
- display_url
- url
- user_mentions (配列)
- geo
- id
- source
- in_reply_to_status_id_str
- retweet_count
- in_reply_to_user_id_str
- place
- created_at
- truncated