プロジェクト

全般

プロフィール

バグ #1285

完了

ツイート引用URLを含むツイートをStream受信したときに引用URLおよび引用ツイートが表示されない

Izumi Tsutsui さんが5年以上前に追加. ほぼ5年前に更新.

ステータス:
終了
優先度:
通常
担当者:
対象バージョン:
プラグイン名:
twitter
クラッシュする:
いいえ

説明

どちらかというと従来の「環境対応」ですが、

題名の通りで、ツイート引用URLを含むツイートをStream受信したときに
引用URLおよび引用ツイートが表示されなくなっています。


具体的には、 stream response で full_text にツイート引用URLが含まれなくなったようです。
https://social.mikutter.hachune.net/@tsutsuii/100452831249626952
https://social.mikutter.hachune.net/@tsutsuii/100452981401628790
https://gist.github.com/tsutsui/c8e5b7d6e259e91a3743e04856aadce9

rest の response だと full_text にツイート引用URLは含まれます。
https://social.mikutter.hachune.net/@tsutsuii/100453025697122706
https://gist.github.com/tsutsui/48f4534c23079e9870981395177f2f8f

さらに、ツイートURL引用 + 画像添付 の場合は full_text にツイート引用URLが含まれます。
https://social.mikutter.hachune.net/@tsutsuii/100453227224311163
https://gist.github.com/tsutsui/a2abed9f8a5e14b0402ea4b0f2031684

画像2枚目以降のURL同様に entity を見て追加および quited_tweet の処理を追加してやる必要がある?

https://m6n.onsen.tech/@tmyt/100453065054284061

@tsutsuii quoted_status_perma_link にdisplay_urlとexpanded_urlあたりの相当が含まれてるのでそれを各自末尾に足してねって感じですかね…

なお、この現象に最初に気づいたのは 7/22 未明です。
https://social.mikutter.hachune.net/@tsutsuii/100413637323751904


ファイル

tsutsuii-1023228842616315906.png (13.4 KB) tsutsuii-1023228842616315906.png Izumi Tsutsui, 2018-07-29 01:28
tsutsuii-1023228842616315906-web.png (26.9 KB) tsutsuii-1023228842616315906-web.png Izumi Tsutsui, 2018-07-29 01:28
moveccr-1042416991200411648-web.png (46.3 KB) moveccr-1042416991200411648-web.png Izumi Tsutsui, 2018-09-19 23:27
moveccr-1042416991200411648.png (14.6 KB) moveccr-1042416991200411648.png Izumi Tsutsui, 2018-09-19 23:27
tsutsuii-1103295647304708096.png (8.43 KB) tsutsuii-1103295647304708096.png Izumi Tsutsui, 2019-03-07 01:28
tsutsuii-1103295647304708096-web.png (20.2 KB) tsutsuii-1103295647304708096-web.png Izumi Tsutsui, 2019-03-07 01:28
0001-Filterstream-RT-quoted_status_permalink.patch (2.44 KB) 0001-Filterstream-RT-quoted_status_permalink.patch Izumi Tsutsui, 2019-03-10 15:02
0001-Filterstream-RT-quoted_status_permalink-2.patch (2.79 KB) 0001-Filterstream-RT-quoted_status_permalink-2.patch Izumi Tsutsui, 2019-03-11 02:33
n_soda-1105112522196049921.png (50 KB) n_soda-1105112522196049921.png Izumi Tsutsui, 2019-03-11 23:37
0001-Filterstream-RT-quoted_status_permalink-3.patch (3.33 KB) 0001-Filterstream-RT-quoted_status_permalink-3.patch Izumi Tsutsui, 2019-03-12 00:53
key-1104613387940507649.txt (1.43 KB) key-1104613387940507649.txt Izumi Tsutsui, 2019-04-23 02:44
key-1120379459150868480.txt (3.84 KB) key-1120379459150868480.txt Izumi Tsutsui, 2019-04-23 02:44
key-1120374613161021442.txt (5.21 KB) key-1120374613161021442.txt Izumi Tsutsui, 2019-04-23 02:44
key-1120366803123761153.txt (10.8 KB) key-1120366803123761153.txt Izumi Tsutsui, 2019-04-23 02:44
key-1120371707783417857.txt (5.38 KB) key-1120371707783417857.txt Izumi Tsutsui, 2019-04-23 02:44
tsutsuii-1120371707783417857.png (25.1 KB) tsutsuii-1120371707783417857.png Izumi Tsutsui, 2019-04-23 02:44
tsutsuii-1120374613161021442.png (38.3 KB) tsutsuii-1120374613161021442.png Izumi Tsutsui, 2019-04-23 02:44
tsutsuii-1120366803123761153.png (34.8 KB) tsutsuii-1120366803123761153.png Izumi Tsutsui, 2019-04-23 02:45
tsutsuii-1120379459150868480.png (21.2 KB) tsutsuii-1120379459150868480.png Izumi Tsutsui, 2019-04-23 02:45
tsutsuii-1104613387940507649.png (29.4 KB) tsutsuii-1104613387940507649.png Izumi Tsutsui, 2019-04-23 02:45

再現手順

  • 引用ツイートURLを含むツイートを投稿する
  • そのツイートを userstream で受信する
    →引用ツイートURLが本文に表示されず、 quoted_tweet の引用ツイート表示もされない
    • REST で受信した場合はどちらも表示される

toshi_a 初音 さんが5年以上前に更新

  • ステータス分類待ち から 実装待ち に変更

UserStream限定の問題ですね。

今の所、あと半月でUserStreamは廃止されると発表されているので、残りの期間を快適に過ごすためにも最優先で対応したいところです。

Izumi Tsutsui さんが5年以上前に更新

userstream 廃止から久しいですが、 filterstream でも同様の現象になるようです
(≒今の mikutter でもまだ対策が必要?)

Izumi Tsutsui さんが約5年前に更新


いまさらですが json はこんな感じです
(by https://github.com/toshia/debug_tools )


{:created_at=>"Wed Mar 06 14:05:55 +0000 2019",
 :id=>1103295647304708096,
 :id_str=>"1103295647304708096",
 :full_text=>"う。",
 :truncated=>false,
 :display_text_range=>[0, 2],
 :entities=>{:hashtags=>[], :symbols=>[], :user_mentions=>[], :urls=>[]},
 :source=>"mikutter alternative",
 :in_reply_to_status_id=>nil,
 :in_reply_to_status_id_str=>nil,
 :in_reply_to_user_id=>nil,
 :in_reply_to_user_id_str=>nil,
 :in_reply_to_screen_name=>nil,
 :user=>TwitterUser(@tsutsuii),
 :geo=>nil,
 :coordinates=>nil,
 :place=>nil,
 :contributors=>nil,
 :is_quote_status=>true,
 :quoted_status_id=>1103291265918087171,
 :quoted_status_id_str=>"1103291265918087171",
 :quoted_status_permalink=>
  {:url=>"https://t.co/zZb2oZ1QUs",
   :expanded=>"https://twitter.com/PkgsrcChanges/status/1103291265918087171",
   :display=>"twitter.com/PkgsrcChanges/…"},
 :quoted_status=>
  {:created_at=>"Wed Mar 06 13:48:30 +0000 2019",
   :id=>1103291265918087171,
   :id_str=>"1103291265918087171",
   :full_text=>
    "www/webkit-gtk [pkgsrc-2018Q4]: Makefile PLIST distinfo
" +
    "www/webkit-gtk/patches [pkgsrc-2018Q4]:
" +
    "...
" +
    " 
" +
    "bsiegert: www/webkit-gtk: security fix (remote code execution)
" +
    " 
" +
    "https://t.co/SrGebOSkiz
" +
    "https://t.co/ng2rjkze4f
" +
    "https://t.co/kabngZo54V
" +
    "https://t.co/crOy3b2EBK",
   :truncated=>false,
   :display_text_range=>[0, 260],
   :entities=>
    {:hashtags=>[],
     :symbols=>[],
     :user_mentions=>[],
     :urls=>
      [{:url=>"https://t.co/SrGebOSkiz",
        :expanded_url=>
         "http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/www/webkit-gtk/Makefile.diff?r1=1.155&r2=1.155.2.1",
        :display_url=>"cvsweb.netbsd.org/bsdweb.cgi/pkg…",
        :indices=>[165, 188]},
       {:url=>"https://t.co/ng2rjkze4f",
        :expanded_url=>
         "http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/www/webkit-gtk/PLIST.diff?r1=1.45&r2=1.45.2.1",
        :display_url=>"cvsweb.netbsd.org/bsdweb.cgi/pkg…",
        :indices=>[189, 212]},
       {:url=>"https://t.co/kabngZo54V",
        :expanded_url=>
         "http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/www/webkit-gtk/distinfo.diff?r1=1.114&r2=1.114.2.1",
        :display_url=>"cvsweb.netbsd.org/bsdweb.cgi/pkg…",
        :indices=>[213, 236]},
       {:url=>"https://t.co/crOy3b2EBK",
        :expanded_url=>
         "http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/www/webkit-gtk/patches/patch-Source_JavaScriptCore_dfg_DFGDoesGC.cpp?rev=1.1",
        :display_url=>"cvsweb.netbsd.org/bsdweb.cgi/pkg…",
        :indices=>[237, 260]}]},
   :source=>
    "<a href="http://www.netmeister.org/apps/tweet/" rel="nofollow">very-simple-tweet</a>",
   :in_reply_to_status_id=>nil,
   :in_reply_to_status_id_str=>nil,
   :in_reply_to_user_id=>nil,
   :in_reply_to_user_id_str=>nil,
   :in_reply_to_screen_name=>nil,
   :user=>
    {:id=>2437851661,
     :id_str=>"2437851661",
     :name=>"Pkgsrc Changes",
     :screen_name=>"PkgsrcChanges",
     :location=>"The Internet",
     :description=>
      "Pkgsrc commit messages as tweets. See @netbsdsrc for NetBSD commit messages.
" +
      "Run by @jschauma.",
     :url=>"http://t.co/Ve3OJR7Mjy",
     :entities=>
      {:url=>
        {:urls=>
          [{:url=>"http://t.co/Ve3OJR7Mjy",
            :expanded_url=>"http://mail-index.netbsd.org/pkgsrc-changes/",
            :display_url=>"mail-index.netbsd.org/pkgsrc-changes/",
            :indices=>[0, 22]}]},
       :description=>{:urls=>[]}},
     :protected=>false,
     :followers_count=>136,
     :friends_count=>1,
     :listed_count=>13,
     :created_at=>"Fri Apr 11 03:01:16 +0000 2014",
     :favourites_count=>0,
     :utc_offset=>nil,
     :time_zone=>nil,
     :geo_enabled=>false,
     :verified=>false,
     :statuses_count=>81623,
     :lang=>"en",
     :contributors_enabled=>false,
     :is_translator=>false,
     :is_translation_enabled=>false,
     :profile_background_color=>"FFFFFF",
     :profile_background_image_url=>
      "http://abs.twimg.com/images/themes/theme1/bg.png",
     :profile_background_image_url_https=>
      "https://abs.twimg.com/images/themes/theme1/bg.png",
     :profile_background_tile=>false,
     :profile_image_url=>
      "http://pbs.twimg.com/profile_images/454454797442113536/ijZroPXp_normal.png",
     :profile_image_url_https=>
      "https://pbs.twimg.com/profile_images/454454797442113536/ijZroPXp_normal.png",
     :profile_banner_url=>
      "https://pbs.twimg.com/profile_banners/2437851661/1397185556",
     :profile_link_color=>"B84E0D",
     :profile_sidebar_border_color=>"FFFFFF",
     :profile_sidebar_fill_color=>"DDEEF6",
     :profile_text_color=>"333333",
     :profile_use_background_image=>false,
     :has_extended_profile=>false,
     :default_profile=>false,
     :default_profile_image=>false,
     :following=>false,
     :follow_request_sent=>false,
     :notifications=>false,
     :translator_type=>"none"},
   :geo=>nil,
   :coordinates=>nil,
   :place=>nil,
   :contributors=>nil,
   :is_quote_status=>false,
   :retweet_count=>0,
   :favorite_count=>0,
   :favorited=>false,
   :retweeted=>false,
   :possibly_sensitive=>false,
   :lang=>"ro"},
 :retweet_count=>0,
 :favorite_count=>0,
 :favorited=>false,
 :retweeted=>false,
 :lang=>"ja",
 :message=>"う。",
 :created=>2019-03-06 23:05:55 +0900,
 :exact=>false,
 :receiver=>nil,
 :replyto=>nil,
 :retweet=>nil,
 :modified=>2019-03-06 23:05:55 +0900}

:is_quote_status=>true を見るべきかどうかはともかく
:quoted_status_permalink=> :display
を見るようにすればいいんですかね。

Izumi Tsutsui さんが約5年前に更新

とりあえず以下の方針で全然わからないまま雰囲気でコピペしたところ、
最低限の要件としての
「filterstreamで受信したツイートの引用RTのURL表示」
はされるようになりました。

  • quoted_status_permalink から url を取り出す
  • filterstream の場合は :full_text がないようなので、full_text が無い場合は quoted_status_permalink から取り出した url を本文の score に追加する
  • 仮に full_text があった場合でも quoted_status_permalink から取り出した url が full_text に含まれない場合も本文の score に追加する
    (これのテストができていない)

0001-Filterstream-RT-quoted_status_permalink.patch

Izumi Tsutsui さんが約5年前に更新

  • 仮に full_text があった場合でも quoted_status_permalink から取り出した url が full_text に含まれない場合も本文の score に追加する
    (これのテストができていない)

引用RTのURLを含めると 140文字を超えるツイートの filterstream 受信の場合、
full_text が付与されるがその中に引用RTのURLは含まれない、という応答のようです。
この場合でも意図(?)通り引用URLツイートは表示されました。

Izumi Tsutsui さんが約5年前に更新

filterstream 受信と full_text まとめ

なお、いずれの場合も message の要素が存在し、それには引用URLを含まない本文が含まれている。

Izumi Tsutsui さんが約5年前に更新

反例

ツイート本文が ja_JP.UTF-8 かつ 140文字以下で rest 受信した場合 にもかかわらず
text あり full_text なし text は引用RTのURLを 含む
entities の urls に引用RTのURLを 含む
という事案が観測されたので、今のパッチではダメで修正が必要になりました……

https://twitter.com/n_soda/status/1105112522196049921

https://gist.github.com/tsutsui/04921a03c6821b0b4042da8ad7fcb453

Izumi Tsutsui さんが約5年前に更新

雑に
!(textがある && textに引用RT URLが含まれる) && !(full_textがある && full_textに引用RT URLが含まれる)
という判定で書き直してみた(対処療法)
0001-Filterstream-RT-quoted_status_permalink-3.patch

toshi_a 初音 さんがほぼ5年前に更新

  • ステータス実装待ち から パッチ適用待ち に変更
  • 担当者toshi_a 初音 にセット

今のmikutterに適用してみる

toshi_a 初音 さんがほぼ5年前に更新

  • ステータスパッチ適用待ち から レビュー待ち に変更
  • 担当者toshi_a 初音 から Izumi Tsutsui に変更
  • プラグイン名twitter にセット
  • ブランチtopic/1285-fix-twitter-streaming-api-quoted-tweet にセット

mergeしてみました。しかし凍結アカウントではStreaming APIに繋げない…

Izumi Tsutsui さんがほぼ5年前に更新

未だに Twitter側の応答の法則が不明ですが、
topic/1285-fix-twitter-streaming-api-quoted-tweet で
以下のパターンで意図通り表示されていると思います。


textあり、 full_text なし、 text に引用ツイートURLが含まれる

key-1120371707783417857.txt


textあり、 full_text なし、 text に引用ツイートURLが含まれない

key-1120366803123761153.txt


textあり、 full_text あり、 text と full_text のいずれにも引用ツイートURLが含まれる

key-1120374613161021442.txt


textなし、 full_text あり、 full_text に引用ツイートURLが含まれない

key-1120379459150868480.txt


textなし、 full_text あり、 full_text に引用ツイートURLが含まれる (これは REST 取得)

key-1104613387940507649.txt

toshi_a 初音 さんがほぼ5年前に更新

  • ステータスマージ待ち から 終了 に変更

merged.

他の形式にエクスポート: Atom PDF