taukit/webscraping/utils.py
def load_item(body, item_loader, item=None, url='placeholder_url',
              callback=None, encoding='utf-8'):
    """Load item from HTML string.

    Parameters
    ----------
    body : str
        String with valid HTML markup.
    item_loader : BaseItemLoader
        Item loader class sublassing the `BaseItemLoader` defined in `items.py`.
    item : scrapy.Item
        Optional item class to be used instead of the `item_loader` default.
    url : str
        Optional url to pass to the response.
        For most of cases it should be left as is.
    callback : func
        Optional callback function to perform on item loader after setup.
        Callback should not return any value,
        but only modify the state of the loader.
        This meant mostly to use additional setup methods
        defined on a given item loader class.
    encoding : str
        Response encoding. Defaults to UTF-8.

    Returns
    -------
    scrapy.Item
        Item object populated with data extracted from an HTML markup.
    """
    response = HtmlResponse(url=url, body=body, encoding=encoding)
    if item:
        loader = item_loader(item=item(), response=response)
    else:
        loader = item_loader(response=response)
    loader.setup()
    if callback:
        callback(loader)
    item = loader.load_item()
    return item
Load item from HTML string.

    Parameters
    ----------
    body : str
        String with valid HTML markup.
    item_loader : BaseItemLoader
        Item loader class sublassing the `BaseItemLoader` defined in `items.py`.
    item : scrapy.Item
        Optional item class to be used instead of the `item_loader` default.
    url : str
        Optional url to pass to the response.
        For most of cases it should be left as is.
    callback : func
        Optional callback function to perform on item loader after setup.
        Callback should not return any value,
        but only modify the state of the loader.
        This meant mostly to use additional setup methods
        defined on a given item loader class.
    encoding : str
        Response encoding. Defaults to UTF-8.

    Returns
    -------
    scrapy.Item
        Item object populated with data extracted from an HTML markup.
    
Load item from HTML string.
Parameters

body : str
String with valid HTML markup.
item_loader : BaseItemLoader
Item loader class sublassing the `BaseItemLoader` defined in `items.py`.
item : scrapy.Item
Optional item class to be used instead of the `item_loader` default.
url : str
Optional url to pass to the response.
For most of cases it should be left as is.
callback : func
Optional callback function to perform on item loader after setup.
Callback should not return any value,
but only modify the state of the loader.
This meant mostly to use additional setup methods
defined on a given item loader class.
encoding : str
Response encoding. Defaults to UTF-8.

Returns

scrapy.Item
Item object populated with data extracted from an HTML markup.
Load item from HTML string . Parameters body : str String with valid HTML markup . item_loader : BaseItemLoader Item loader class sublassing the ` BaseItemLoader ` defined in ` items . py ` . item : scrapy . Item Optional item class to be used instead of the ` item_loader ` default . url : str Optional url to pass to the response . For most of cases it should be left as is . callback : func Optional callback function to perform on item loader after setup . Callback should not return any value but only modify the state of the loader . This meant mostly to use additional setup methods defined on a given item loader class . encoding : str Response encoding . Defaults to UTF - 8 . Returns scrapy . Item Item object populated with data extracted from an HTML markup .
def load_item(body, item_loader, item=None, url='placeholder_url',
              callback=None, encoding='utf-8'):
    response = HtmlResponse(url=url, body=body, encoding=encoding)
    if item:
        loader = item_loader(item=item(), response=response)
    else:
        loader = item_loader(response=response)
    loader.setup()
    if callback:
        callback(loader)
    item = loader.load_item()
    return item
def load_item ( body , item_loader , item = None , url = 'placeholder_url' , callback = None , encoding = 'utf-8' ) : response = HtmlResponse ( url = url , body = body , encoding = encoding ) if item : loader = item_loader ( item = item ( ) , response = response ) else : loader = item_loader ( response = response ) loader . setup ( ) if callback : callback ( loader ) item = loader . load_item ( ) return item
Load item from HTML string.
Load item from HTML string .
"""Load item from HTML string.

    Parameters
    ----------
    body : str
        String with valid HTML markup.
    item_loader : BaseItemLoader
        Item loader class sublassing the `BaseItemLoader` defined in `items.py`.
    item : scrapy.Item
        Optional item class to be used instead of the `item_loader` default.
    url : str
        Optional url to pass to the response.
        For most of cases it should be left as is.
    callback : func
        Optional callback function to perform on item loader after setup.
        Callback should not return any value,
        but only modify the state of the loader.
        This meant mostly to use additional setup methods
        defined on a given item loader class.
    encoding : str
        Response encoding. Defaults to UTF-8.

    Returns
    -------
    scrapy.Item
        Item object populated with data extracted from an HTML markup.
    """
body
item_loader
item
url
callback
encoding