taiki-t's diary

React Native, Rails そして雑多な記録: The world is waiting for you to give it a meaning.

Twitterの検索結果からtweetのurl一覧を取得

$$('.time > a').map(v => v.href)

↑これをChrome の console に貼り付けてEnter

consoleは、macだったら Shift + Command + C で開くと思う。

やってるのは、<time>要素内の<a>各要素からhrefを取得してる。マークアップに依存してるので、いつ使えなくなってもおかしくない。

Chrome Console の Command Line APIについて詳しくは:

https://developers.google.com/web/tools/chrome-devtools/console/command-line-reference

追記: 2017-12-18

下記コマンドで直接クリップボードにコピーできる

copy($$('.time > a').map(v => v.href))