def __init__(self, item, response): ItemLoader.__init__(self, item=item, response=response) self.add_css('title', '#content>h1::text') self.add_css('full_title', '.topic-doc td.tablecc::text') self.add_css('content', '.topic-richtext>p') self.add_css('image_num', '.topic-richtext img') self.add_css('date', '.topic-doc>h3>span:nth-last-of-type(1)::text')
def __init__(self, item=None, selector=None, response=None, parent=None, **context): ''' 完成self.add_func的配置 ''' ItemLoader.__init__(self, item, selector, response, parent, **context) add_func = dict() add_func['xpath'] = self.add_xpath add_func['value'] = self.add_value add_func['css'] = self.add_css self.add_func = add_func
def __init__(self, *args, **kargs): ScrapyItemLoader.__init__(self, *args, **kargs)
def __init__(cls, item, response): ItemLoader.__init__(cls, item, response)
def __init__(self, item, selector): ItemLoader.__init__(self, item=item, selector=selector) self.add_css('title', '.title>a::text') self.add_css('author', 'td:nth-of-type(2)>a::text') self.add_css('url', '.title>a::attr(href)') self.add_css('lastRespStr', 'td:nth-of-type(4)::text')
def __init__(self, response=None): ItemLoader.__init__(self, item=FocusItem(), response=response)