webmaster-kazu.com

テクノロジー・データ分析・実践ログ・その他

Python用の自動で高速、そして軽量なWebスクレイパー「autoscraper」のインストール

カテゴリ: Python【初歩から現場実務的なもの】

Python用の自動で高速、そして軽量なWebスクレイパー「autoscraper」のインストールについて解説しています。

「autoscraper(https://github.com/alirezamika/autoscraper)」は、簡単に自動的なウェブスクレイピングを行うために作られたものです。

■Python

今回のPythonのバージョンは、「3.8.5」を使用しています。(Windows10)(pythonランチャーでの確認)

■autoscraperをインストールする

autoscraperをインストールを行いますが、今回はpipを経由してインストールを行うので、まずWindowsのコマンドプロンプトを起動します。

pip install autoscraper

起動後、上記のコマンドを入力し、Enterキーを押します。

なお、今回は、pythonランチャーを使用しており、Python Version 3.8.5にインストールを行うために、pipを使う場合にはコマンドでの切り替えを行います。

py -3.8 -m pip install autoscraper

切り替えるために、上記のコマンドを入力し、Enterキーを押します。

Defaulting to user installation because normal site-packages is not writeable

Collecting autoscraper

Downloading autoscraper-1.1.12-py3-none-any.whl (10 kB)

Requirement already satisfied: requests in c:\users\user_\appdata\roaming\python\python38\site-packages (from autoscraper) (2.25.1)

Collecting bs4

Using cached bs4-0.0.1.tar.gz (1.1 kB)

Preparing metadata (setup.py) ... done

Requirement already satisfied: lxml in c:\users\user_\appdata\roaming\python\python38\site-packages (from autoscraper) (4.6.3)

Requirement already satisfied: beautifulsoup4 in c:\users\user_\appdata\roaming\python\python38\site-packages (from bs4->autoscraper) (4.9.3)

Requirement already satisfied: certifi>=2017.4.17 in c:\users\user_\appdata\roaming\python\python38\site-packages (from requests->autoscraper) (2021.5.30)

Requirement already satisfied: chardet<5,>=3.0.2 in c:\users\user_\appdata\roaming\python\python38\site-packages (from requests->autoscraper) (4.0.0)

Requirement already satisfied: idna<3,>=2.5 in c:\users\user_\appdata\roaming\python\python38\site-packages (from requests->autoscraper) (2.10)

Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\user_\appdata\roaming\python\python38\site-packages (from requests->autoscraper) (1.26.5)

Requirement already satisfied: soupsieve>1.2 in c:\users\user_\appdata\roaming\python\python38\site-packages (from beautifulsoup4->bs4->autoscraper) (2.2.1)

Building wheels for collected packages: bs4

Building wheel for bs4 (setup.py) ... done

Created wheel for bs4: filename=bs4-0.0.1-py3-none-any.whl size=1271 sha256=2c03c26001a849424717390f54d366d00a64bfc38b031d28a794872f65db7ed3

Stored in directory: c:\users\user_\appdata\local\pip\cache\wheels\75\78\21\68b124549c9bdc94f822c02fb9aa3578a669843f9767776bca

Successfully built bs4

Installing collected packages: bs4, autoscraper

Successfully installed autoscraper-1.1.12 bs4-0.0.1

Enterキーを押すと、インストールが開始され、上記のように「Successfully installed」と表示されます。これが表示されれば、autoscraperが正常にインストールされたことになります。

なお、今回はautoscraperのバージョン1.1.12をインストールしました。