0
웹 사이트의 모든 이름을 Scrapy를 사용하여 https://www.internationaltelecomsweek.com에서 긁어 내고 싶습니다.웹 사이트를 긁어 낸 후 데이터가 없음
이것은 항목 파일에 있습니다.
import scrapy
class ItwItem(scrapy.Item):
name = scrapy.Field()
이것은 내 거미입니다.
import scrapy
from itw.items import ItwItem
class ItwSpider(scrapy.Spider):
name = 'itw'
allowed_domains = ['https://www.internationaltelecomsweek.com']
start_urls = ['https://www.internationaltelecomsweek.com/this-year/companies-attending']
def parse(self, response):
data= json.loads(response.body)
for i in data:
item["name"] = i["DisplayName"]
return item
치료를 실행할 때 비어있는 CSV 파일 만받습니다. 내가 도대체 뭘 잘못하고있는 겁니까?
당신이지고 어떤 오류? – rongon
들여 쓰기 오류 : 들여 쓰기가 바깥 쪽 들여 쓰기 레벨과 일치하지 않습니다. – Hasan
들여 쓰기가 올바르지 않음을 나타냅니다. 게시 한 예제 코드는 parse-function 아래에 있어야합니다. 즉, 8 칸을 들여 써야합니다. – rongon