#author("2021-04-14T08:32:04+00:00","default:hotate","hotate")
#author("2023-10-22T08:52:04+00:00;2021-04-14T08:32:04+00:00","default:hotate","hotate")
#contents
&tag(スクレイピング, Python);
&tag(スクレイピング,Python);

* 情報 [#x2e47584]
- [[Scrapy 2.4 documentation — Scrapy 2.4.1 documentation>https://doc.scrapy.org/en/latest/index.html]]
 Scrapy is a fast high-level web crawling and web scraping framework, used to crawl websites and extract structured data from their pages.
- [[Scrapy 1.7 文書 — Scrapy 1.7.3 ドキュメント>https://doc-ja-scrapy.readthedocs.io/ja/latest/#]]
 Scrapyは高速で高レベルのWebクロール(web crawling)およびWebスクレイピング(web scraping)フレームワークであり、Webサイトをクロールし、ページから構造化データを抽出するために使用されます。
- [[Python, Scrapyの使い方(Webクローリング、スクレイピング) | note.nkmk.me>https://note.nkmk.me/python-scrapy-tutorial/]]
 Scrapyはスクレイピングだけでなくクローリングも行う。複数ページを対象とするのならScrapyのほうが便利。
- [[10分で理解する Scrapy - Qiita>https://qiita.com/Chanmoro/items/f4df85eb73b18d902739]]
 Scrapy はこれらのライブラリと違うレイヤーのもので、クローラーのアプリケーション全体を実装するためのフレームワークです
- [[python - How can I get all the plain text from a website with Scrapy? - Stack Overflow>https://stackoverflow.com/questions/23156780/how-can-i-get-all-the-plain-text-from-a-website-with-scrapy]]
 The easiest option would be to extract //body//text() and join everything found:
 ''.join(sel.select("//body//text()").extract()).strip()
-- コメント:別案の[[BeautifulSoup]]を使う方がテキスト抽出の精度が良かった。(2021/01/10)
 Another option is to use BeautifulSoup's get_text():

** パイプライン [#m6c6172f]
- [[Scrapyでけ日記をクローリングする (2. PipelineでPostgreSQLに保存する) - け日記>https://ohke.hateblo.jp/entry/2018/07/07/230000]]
 今回はクローリングで得られた値を、バリデーションしてPostgreSQLに保存するPipelineを実装します。

* [[Python3]] [#o5c891bf]
** Python 3.8 [#mee70046]
- [[Can't install python 3.8.1 scrapy in venv on windows 10 64 bits - Stack Overflow>https://stackoverflow.com/questions/59800514/cant-install-python-3-8-1-scrapy-in-venv-on-windows-10-64-bits]]
 See this answer for an explanation and a workaround if you don't want to download all 4GB: stackoverflow.com/a/43409948/5910149 –

** Python 3.9 [#x33571e3]
- [[Release notes — Scrapy 2.5.0 documentation>https://docs.scrapy.org/en/latest/news.html#scrapy-2-5-0-2021-04-06]]
 Scrapy 2.5.0 (2021-04-06)
 - Official Python 3.9 support
- %%[[error on "pip install scrapy" · Issue #3633 · scrapy/scrapy>https://github.com/scrapy/scrapy/issues/3633#issuecomment-759709626]]%%
 you can't install scrapy using python 3.9+, it depends on Twisted which can't be installed using pip starting 3.9 because of deprecation issue, the only way to do it is to downgrade you're python version (can be done easily with pyenv) or to download and install Twisted manually

* 関連 [#pd6dd7cb]
- [[Python]]

#related

#taglist(tag=スクレイピング)

トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS