特定の日時のリンク一覧を取得
Twitterでブログなどに特定の日時のツイートのリンクをコピーしたいことがある。
例えばiwb.jpの場合は月に一度いいねのページから前月のリンク一覧をコピーしてブログに貼り付けて投稿している。
やり方は簡単で必要な範囲のツイートが表示されるまでスクロールしてChromeのデベロッパーツールで下記のコマンドを実行するだけだ。
// 実行するとundefinedと表示されるが問題なクリップボードにコピーされている copy($$('.stream-items [title*="2017年2月"]').reverse().join('\n'))
reverse()は取得した順番を反転するために使用している。
例えばtrump taxと検索してスクロールしてツイートを一定量表示させたあとに下記を実行すれば2017年2月4日分のツイートのリンク一覧をコピーすることができる。
copy($$('.stream-items [title*="2017年2月4日"]').join('\n'))
コピーしてブログに貼り付けると以下のように表示される。
https://twitter.com/realpamdorra/status/827746209238429698
https://twitter.com/2020fight/status/827732201794052096
As Trump flies to FL on vacation on Air Force One, it's a good time to revisit his feelings about wasting tax payer money in this way. https://t.co/rLi3x6CyVG
— Facts Do Matter (@WilDonnelly) February 4, 2017
https://twitter.com/KaivanShroff/status/827695464405401600
They don't care who gets care or who dies as long as the 1% gets a tax break pic.twitter.com/XqRda7soyz
— Stop Trump (@StopTrump2020) February 4, 2017
https://twitter.com/Millennial_Dems/status/827675628568711168
LOL‼️ Al Sharpton's daughter arrested protesting at Trump Tower. When is her daddy getting arrested for tax evasion? https://t.co/1Ae2CmTk99
— Cristina Laila (@cristinalaila1) February 3, 2017
Schwarzenegger fans the flames of Trump feud with a jab about his tax returns https://t.co/aJ0N0v5qvx pic.twitter.com/2XiJbMpc5e
— The Hill (@thehill) February 3, 2017
https://twitter.com/TwitterMoments/status/827654536269434882
https://twitter.com/KaivanShroff/status/827648612133912579
https://twitter.com/KaivanShroff/status/827643645276876800