スクレイピングエラーの解決方法-Only the following pseudo-classes are implemented: nth-of-type
PythonのBeautifulSoupでスクレイピングをしようとしたときに下記のようなエラーがでました。
NotImplementedError: Only the following pseudo-classes are implemented: nth-of-type.
これはBeautifulSoupではコロンが疑似クラスとして認識されてしまうことが原因のようです。
解決策は色々ありますが、もっともシンプルで簡単な解決方法はBeautifulSoupのアップグレードです。
この問題はBeautifulSoup 4.5.0以降では解決されているので以下のコマンドを実行してアップグレードしましょう。
pip install --upgrade beautifulsoup4