URL : https://www.alexa.com/topsites
참고 URL : https://docs.scrapy.org/en/latest/topics/item-pipeline.html
contents
1. Pipeline 초기화 메소드
2. Item CSV 저장
3. Item Excel 저장
1. Pipeline 초기화 메소드 & CSV, Excel 저장
Pipeline 초기화 메소드를 선언하기 전에 items.py 을 설정해준다.
built in function(내장함수)인 __init__()를 사용하여 초기화 한다.
엑셀과 CSV로 저장하기 위해서 workbook, worksheet, file_opener를 선언한다.
pipelines.py 의 process_item 메소드에 엑셀과 csv 파일을 저장해준다.
spider code는 10.PipeLine(1)과 같다.
'Scrapy' 카테고리의 다른 글
[Scrapy] 10. PipeLine(1) (0) | 2020.04.16 |
---|---|
[Scrapy] 09. Settings (0) | 2020.04.10 |
[Scrapy] 08. Items (0) | 2020.04.08 |
[Scrapy] 07. Selectors(css, xpath) (0) | 2020.04.08 |
[Scrapy] 06. Scrapy Spider 활용 (0) | 2020.04.08 |
댓글