LoginSignup
2
1

More than 1 year has passed since last update.

jQueryとchrome拡張機能でお手軽な画像スクレイピング

Last updated at Posted at 2019-02-10

要件

現在表示しているページの画像をまとめて保存したい。
liタグや兄弟要素で特にかなり楽にスクレイピングできる。

サンプル(ヤ●オクの商品ページ)

$('.ProductImage__link img').each(function(i, element){window.open(element.currentSrc)});

上記のコードをコンソールで実行後、拡張機能で一括保存

材料

手順

  1. 保存したい画像のセレクタを確認

    → 上記の例だとimgタグにクラスがないので、親のaタグを利用して

     $('.ProductImage__link img')として要素を取得できます。
  2. each()でwindow.open('画像のURL')を実行
  3. Save Tabbed Imagesで保存

実行イメージ

jQuery.gif

感想

jQuery、まだまだ現役👴
jQuery読み込んでなかったら使えないけどそこはご愛嬌
window.open()は使えない時もあるよ

2
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1