Scrapy spider for TW Rental House
TW Rental House Utility for Scrapy
This package is built for crawling Taiwanese rental house related website using Scrapy. As behaviour of crawlers may differ from their goal, scale, and pipeline, this package provides only minimun feature set, which allow developer to list and decode a rental house web page into structured data, without knowning too much about detail HTML and API structure of each website. In addition, this package is also designed for extensibility, which allow developers to insert customized callback, manipulate data, and integrate with existing crawler structure.
Although this package provide the ability to crawl rental house website, it's developer's responsibility to ensure crawling mechanism and usage of data. Please be friendly to target website, such as consider using DOWNLOAD_DELAY or AUTO_THROTTLING to prevent bulk requesting.
- Python 3.5+
pip install scrapy-tw-rental-house
This package currently support 591. Each rental house website is a Scrapy Spider class. You can either crawl entire website using default setting , which will take couple days, or customize the behaviour base on your need.
The most basic usage would be creating a new Spider class that inherit Rental591Spider:
from scrapy_twrh.spiders.rental591 import Rental591Spider class MyAwesomeSpider(Rental591Spider): name='awesome'
And than start crawling by
scrapy crawl awesome
Please see example for detail usage.
All spiders populates 2 type of Scrapy items:
GenericHouseItem contains normalized data field, spirders from different website will decode their data and fit into this schema in best effort.
RawHouseItem contains unnormalized data field, which keep original and structured data in best effort.
Note that both item are super set of schema. It developer's responsibility to check which field is provided when receiving an item.
For example, in
Rental591Spider, for a single rental house, Scrapy will get:
GenericHouseItemduring listing all houses, which provide only minimun data field for
GenericHouseItemduring retrieving house detail. The 2nd
GenericHouseItemcontains only location info.
All spiders in this package provide the following handlers:
start_list, similiar to
start_requestsin Scrapy, control how crawler issue search/list request to find all rental houses.
parse_list, similiar to
parsein Scrapy, control how crawler handles response from
start_listand generate request for detail house info page.
parse_detail, control how crawler parse detail page.
All spiders implements their own default handler, say,
default_parse_detail, and can be overwrite during
__init__. Please see example for how to control spider behavior using handlers.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size scrapy_tw_rental_house-0.1.2-py3-none-any.whl (37.9 kB)||File type Wheel||Python version py3||Upload date||Hashes View hashes|
|Filename, size scrapy-tw-rental-house-0.1.2.tar.gz (18.6 kB)||File type Source||Python version None||Upload date||Hashes View hashes|
Hashes for scrapy_tw_rental_house-0.1.2-py3-none-any.whl
Hashes for scrapy-tw-rental-house-0.1.2.tar.gz