ウェブスクレイピングのプログラム作成しております。
http://www.itmedia.co.jp/news/articles/1810/14/news009.html
このサイトから記事だけを取得するようなプログラムを書いております。
プログラム抜粋
Python
1from urllib import request 2from pyquery import PyQuery as pq 3 4url_add = "http://www.itmedia.co.jp/news/articles/1810/14/news009.html" 5 6resp = request.urlopen(url_add) 7 8html = resp.read().decode("utf-8") 9print(html) 10query = pq(html)
実行しますと
Traceback (most recent call last):
File "C:/(私のローカルパス)/main.py", line 8, in <module>
html = resp.read().decode("utf-8")
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x94 in position 1185: invalid start byte
とエラーがでます。
url_add = "https://headlines.yahoo.co.jp/article?a=20181014-00549976-shincho-soci"
だとエラーは出ません。
諸先輩方アドバイスを宜しくお願いします。
回答1件
あなたの回答
tips
プレビュー