0
私が考慮され、すなわち、さまざまなオプションを試してみた: - FormRequests - 私が立ち往生続ける渡すクッキーScrapyクッキー受け入れる形
悲しいこと:https://www.marktplaats.nl/cookiewall/?target=https%3A%2F%2Fwww.marktplaats.nl%2F
class MarktplaatsSpider(CrawlSpider):
name = 'MarktplaatsSpidertest'
source = 'Markplaats.nl'
allowed_domains = ['marktplaats.nl']
start_urls = ['https://www.marktplaats.nl/']
rules = [Rule(LinkExtractor(allow=()), callback='parse_item',follow=True)]
def start_request(self):
form_data = {'CookieOptIn':'true'}
request_body = json.dumps(form_data)
yield scrapy.Request('https://www.marktplaats.nl',
method="POST",
body=request_body,
headers={'Content-Type': 'application/json; charset=UTF-8'},)
def parse_item(self, response):
print(response.url)
item['URL'] = response.url
yield item(source=self.source, URL=item['URL'], hash = get_hash(response.url))
いくつかの他のウェブサイトどこがあります。私は同じ問題を横断して来る。私は単に自分のスパイダーがどのようにページにアクセスできるのか分かりません。
誰でも私を助けたり、正しい方向に向けることができますか?
よろしく、
Durk
はい、取得クッキーを手動で解決です!彼はまた、[セレン](http://stackoverflow.com/questions/13287490/is-there-a-way-to-use-phantomjs-inを試すことができます-python)! – nick
それは完璧に働いた、ありがとう! – Durk