Python scrapy.loader.processors.Join() Examples

The following are 4 code examples of scrapy.loader.processors.Join(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module scrapy.loader.processors , or try the search function .
Example #1
Source File: event.py    From In2ItChicago with GNU General Public License v3.0 5 votes vote down vote up
def custom_field():
    return scrapy.Field(input_processor=MapCompose(DataUtils.remove_html), output_processor=Join()) 
Example #2
Source File: event.py    From In2ItChicago with GNU General Public License v3.0 5 votes vote down vote up
def url_field():
    return scrapy.Field(input_processor=MapCompose(DataUtils.remove_html, 
        lambda value: value \
            .replace('//', '/') \
            .replace('https:/', 'https://') \
            .replace('http:/', 'http://') \
            .rstrip('/')),
        output_processor=Join()) 
Example #3
Source File: event.py    From In2ItChicago with GNU General Public License v3.0 5 votes vote down vote up
def category_field():
    return scrapy.Field(output_processor=Join()) 
Example #4
Source File: event.py    From In2ItChicago with GNU General Public License v3.0 5 votes vote down vote up
def address_field():
    def parse_address(value):
        parsed = usaddress.parse(value) 
        def default_or_empty(field, default):
            if any(i[0] for i in parsed if i[1] == field):
                return ''
            return default 
        city_append = default_or_empty("PlaceName", " Chicago, ")
        state_append = default_or_empty("StateName", "IL")
        return f'{value}{city_append}{state_append}' 

    return scrapy.Field(input_processor=MapCompose(
            DataUtils.remove_html,
            parse_address),
        output_processor=Join())