Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.6
Creation-Date: 2023-06-25T[Link]+02:00
====== web scraping ======
Created domingo 25 junio 2023
[Link]
[Link]
[Link]
sudo pacman -S scrapy
scrapy startproject tutorial
cd tutorial/spiders
vim quotes_spider.py
''from pathlib import Path''
''import scrapy''
''class QuotesSpider([Link]):''
''name = "quotes"''
''def start_requests(self):''
''urls = [''
''"''[[[Link]
page/1/'']]''",''
''"''[[[Link]
page/2/'']]''",''
'']''
''for url in urls:''
''yield [Link](url=url, callback=[Link])''
''def parse(self, response):''
''page = [Link]("/")[-2]''
''filename = f"quotes-{page}.html"''
''Path(filename).write_bytes([Link])''
''[Link](f"Saved file {filename}")''
--------------------
cd ../..
scrapy crawl <project_name>
scrapy crawl as -o [Link]
scrapy shell '<url>'
==== how to call from gjs ====
[Link]
==== gjs from IDE ====
[Link]
[Link]
[Link]
==== home assistant API ====
[Link]