4
나는 내가 SgmlLinkExtractor의 수 속성이 명령 줄 매개 변수에 지정된 것을 원하는 다음scrapy에서 crawlspider의 명령 줄 매개 변수에 액세스하는 방법은 무엇입니까?
name = 'example.com'
allowed_domains = ['example.com']
start_urls = ['http://www.example.com']
rules = (
# Extract links matching 'category.php' (but not matching 'subsection.php')
# and follow links from them (since no callback means follow=True by default).
Rule(SgmlLinkExtractor(allow=('category\.php',), deny=('subsection\.php',))),
# Extract links matching 'item.php' and parse them with the spider's method parse_item
Rule(SgmlLinkExtractor(allow=('item\.php',)), callback='parse_item'),
)
처럼 확장 CrawlSpider의 규칙 정의에 사용되는 scrapy crawl ...
명령 줄에서 매개 변수를 전달하려면 . 내가 봤 거든 스파이더의 __init__
메서드에서 매개 변수 값을 얻을 수 있지만 어떻게 명령 줄에서 매개 변수를 얻을 수있는 규칙 정의에 사용되는 발견?