EC2 + Python でスクレイピング処理をしてサイトをぶっこぬいてみた。

環境セットアップメモ

AWS AMI 環境が前提条件です。

# lxml のインストールのために必要
# http://dev.classmethod.jp/cloud/aws/preparing-ec2-python-environment/
$ sudo yum -y install libxslt-devel libxml2-devel gcc python-devel

# python ツール群のインストール
# AMI なら pip のインストール要らず
$ sudo pip install lxml requests ipython

スクレイピングコード

https://github.com/ks6088ts/scrape

Git インストールして clone
$ sudo yum install -y git
$ git clone https://github.com/ks6088ts/scrape

Hacker News の記事リストをぶっこ抜く
$ python scrape/hackernews.py anchors https://news.ycombinator.com/

コメント

このブログの人気の投稿

Callback関数を知らん人がまず理解すべきことのまとめ。

C言語でBluetoothスタックを叩きたい人のBluetooth開発入門その1

C++プログラミング入門(1) // 倉庫番プログラムの実装