Scrapyクラスはどのように実行され、どのように追加メソッドをスパイダークラスに組み込むのですか?ドキュメントから例えばScrapyクラスでの追加メソッドの定義
、:私は、ポーリングデータベースまたは何か他のもののためにいくつかのメソッドを定義したい場合は
import scrapy
class DmozSpider(scrapy.Spider):
name = "dmoz"
allowed_domains = ["dmoz.org"]
start_urls = [
"http://www.dmoz.org/Computers/Programming/Languages/Python/Books/",
"http://www.dmoz.org/Computers/Programming/Languages/Python/Resources/"
]
def parse(self, response):
filename = response.url.split("/")[-2] + '.html'
with open(filename, 'wb') as f:
f.write(response.body)
は、どのように私はそれについて移動して、なぜでしょうか?
は、あなたがのためにデータベースをポーリングしたいものを詳しく説明していただけますか?ありがとう。 – alecxe
クロールするURL(例: – Adders