0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

beautiful soup4のインスタンス生成時に、lxmlを指定するとスクレイピング時にデータが欠落した問題

Posted at

現象

30件データを取得したいにも関わらず、14件しか取得できません。
image.png

解決策

パース前にパース対象を下記のコードのように、shift-jisからutf-8に変換しておく必要があります。

soup = BeautifulSoup(c.decode("CP932"), "lxml")

image.png

0
1
0

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
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?