URL 시퀀스를 스크랩하고 있습니다. 코드가 작동하지만 치료가 순차적으로 URL을 구문 분석하지 않습니다. 예 : 내가 url1, url2, ..., url100을 분석하려고 시도하고 있지만, scrapy url2, url10, url1 ... 등을 구문 분석합니다.치료 중 루프가 순차적으로 실행되고 있지 않습니다.
모든 URL을 구문 분석하지만 특정 URL이없는 경우 (예 : example.com/unit.aspx?b_id=10) Firefox가 이전 요청의 결과를 보여줍니다. 복제본이 없는지 확인하려면 루프가 순차적으로 URL을 파싱하고 "필요에 따라"가 아닌지 확인해야합니다.
나는 입찰 < 100 "결과는 동일하지만. 사전에감사합니다 (아래 참조)!
def check_login_response(self, response):
"""Check the response returned by a login request to see if we are
successfully logged in.
"""
if "Welcome!" in response.body:
self.log("Successfully logged in. Let's start crawling!")
print "Successfully logged in. Let's start crawling!"
# Now the crawling can begin..
self.initialized()
bID=0
#for n in range(1,100,1):
while bID<100:
bID=bID+1
startURL='https://www.example.com/units.aspx?b_id=%d' % (bID)
request=Request(url=startURL ,dont_filter=True,callback=self.parse_add_tables,meta={'bID':bID,'metaItems':[]})
# print self.metabID
yield request #Request(url=startURL ,dont_filter=True,callback=self.parse2)
else:
self.log("Something went wrong, we couldn't log in....Bad times :(")
# Something went wrong, we couldn't log in, so nothing happens.
고마워요! 이게 효과가있어. – Jmm