我正在使用Scrapy來抓取商業目錄。我有幾個字段,我想要抓住他們的Facebook和Twitter鏈接。但是,並非每次都會有Facebook或Twitter鏈接。使用我現在的代碼只是完全跳過它們。 import scrapy
from scrapy import Request
# TODO: Find a way to scrape even if there is nothing th
我有一個蜘蛛,它從一個redis列表中獲取URL。 我想在沒有找到URL時很好地關閉spider。我試圖執行CloseSpider例外,但它似乎並沒有達到這個地步 def start_requests(self):
while True:
item = json.loads(self.__pop_queue())
if not item:
raise
我試圖在抓取每個頁面的截圖的同時抓取一個網站。到目前爲止,我已設法拼湊下面的代碼: import json
import base64
import scrapy
from scrapy_splash import SplashRequest
class ExtractSpider(scrapy.Spider):
name = 'extract'
def star