itemloaders


Nameitemloaders JSON
Version 1.3.2 PyPI version JSON
download
home_pagehttps://github.com/scrapy/itemloaders
SummaryBase library for scrapy's ItemLoader
upload_time2024-09-30 13:48:49
maintainerNone
docs_urlNone
authorZyte
requires_python>=3.8
licenseBSD
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ===========
itemloaders
===========

.. image:: https://img.shields.io/pypi/v/itemloaders.svg
   :target: https://pypi.python.org/pypi/itemloaders
   :alt: PyPI Version

.. image:: https://img.shields.io/pypi/pyversions/itemloaders.svg
   :target: https://pypi.python.org/pypi/itemloaders
   :alt: Supported Python Versions

.. image:: https://github.com/scrapy/itemloaders/workflows/CI/badge.svg?branch=master
   :target: https://github.com/scrapy/itemloaders/actions?workflow=CI
   :alt: CI Status

.. image:: https://codecov.io/github/scrapy/itemloaders/coverage.svg?branch=master
   :target: https://codecov.io/gh/scrapy/itemloaders
   :alt: Coverage report

.. image:: https://readthedocs.org/projects/itemloaders/badge/?version=latest
   :target: https://itemloaders.readthedocs.io/en/latest/?badge=latest
   :alt: Documentation Status


``itemloaders`` is a library that helps you collect data from HTML and XML sources.

It comes in handy to extract data from web pages, as it supports
data extraction using CSS and XPath Selectors.

It's specially useful when you need to standardize the data from many sources.
For example, it allows you to have all your casting and parsing rules in a
single place.

Here is an example to get you started::

    from itemloaders import ItemLoader
    from parsel import Selector

    html_data = '''
    <!DOCTYPE html>
    <html>
        <head>
            <title>Some random product page</title>
        </head>
        <body>
            <div class="product_name">Some random product page</div>
            <p id="price">$ 100.12</p>
        </body>
    </html>
    '''
    loader = ItemLoader(selector=Selector(html_data))
    loader.add_xpath('name', '//div[@class="product_name"]/text()')
    loader.add_xpath('name', '//div[@class="product_title"]/text()')
    loader.add_css('price', '#price::text')
    loader.add_value('last_updated', 'today') # you can also use literal values
    item = loader.load_item()
    item
    # {'name': ['Some random product page'], 'price': ['$ 100.12'], 'last_updated': ['today']}

For more information, check out the `documentation <https://itemloaders.readthedocs.io/en/latest/>`_.

Contributing
============

All contributions are welcome!

* If you want to review some code, check open
  `Pull Requests here <https://github.com/scrapy/itemloaders/pulls>`_

* If you want to submit a code change

   * File an `issue here <https://github.com/scrapy/itemloaders/issues>`_, if there isn't one yet
   * Fork this repository
   * Create a branch to work on your changes
   * Run `pre-commit install` to install pre-commit hooks
   * Push your local branch and submit a Pull Request

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/scrapy/itemloaders",
    "name": "itemloaders",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "Zyte",
    "author_email": "opensource@zyte.com",
    "download_url": "https://files.pythonhosted.org/packages/b6/3e/c549370e95c9dc7ec5e155c075e2700fa75abe5625608a4ce5009eabe0bf/itemloaders-1.3.2.tar.gz",
    "platform": null,
    "description": "===========\nitemloaders\n===========\n\n.. image:: https://img.shields.io/pypi/v/itemloaders.svg\n   :target: https://pypi.python.org/pypi/itemloaders\n   :alt: PyPI Version\n\n.. image:: https://img.shields.io/pypi/pyversions/itemloaders.svg\n   :target: https://pypi.python.org/pypi/itemloaders\n   :alt: Supported Python Versions\n\n.. image:: https://github.com/scrapy/itemloaders/workflows/CI/badge.svg?branch=master\n   :target: https://github.com/scrapy/itemloaders/actions?workflow=CI\n   :alt: CI Status\n\n.. image:: https://codecov.io/github/scrapy/itemloaders/coverage.svg?branch=master\n   :target: https://codecov.io/gh/scrapy/itemloaders\n   :alt: Coverage report\n\n.. image:: https://readthedocs.org/projects/itemloaders/badge/?version=latest\n   :target: https://itemloaders.readthedocs.io/en/latest/?badge=latest\n   :alt: Documentation Status\n\n\n``itemloaders`` is a library that helps you collect data from HTML and XML sources.\n\nIt comes in handy to extract data from web pages, as it supports\ndata extraction using CSS and XPath Selectors.\n\nIt's specially useful when you need to standardize the data from many sources.\nFor example, it allows you to have all your casting and parsing rules in a\nsingle place.\n\nHere is an example to get you started::\n\n    from itemloaders import ItemLoader\n    from parsel import Selector\n\n    html_data = '''\n    <!DOCTYPE html>\n    <html>\n        <head>\n            <title>Some random product page</title>\n        </head>\n        <body>\n            <div class=\"product_name\">Some random product page</div>\n            <p id=\"price\">$ 100.12</p>\n        </body>\n    </html>\n    '''\n    loader = ItemLoader(selector=Selector(html_data))\n    loader.add_xpath('name', '//div[@class=\"product_name\"]/text()')\n    loader.add_xpath('name', '//div[@class=\"product_title\"]/text()')\n    loader.add_css('price', '#price::text')\n    loader.add_value('last_updated', 'today') # you can also use literal values\n    item = loader.load_item()\n    item\n    # {'name': ['Some random product page'], 'price': ['$ 100.12'], 'last_updated': ['today']}\n\nFor more information, check out the `documentation <https://itemloaders.readthedocs.io/en/latest/>`_.\n\nContributing\n============\n\nAll contributions are welcome!\n\n* If you want to review some code, check open\n  `Pull Requests here <https://github.com/scrapy/itemloaders/pulls>`_\n\n* If you want to submit a code change\n\n   * File an `issue here <https://github.com/scrapy/itemloaders/issues>`_, if there isn't one yet\n   * Fork this repository\n   * Create a branch to work on your changes\n   * Run `pre-commit install` to install pre-commit hooks\n   * Push your local branch and submit a Pull Request\n",
    "bugtrack_url": null,
    "license": "BSD",
    "summary": "Base library for scrapy's ItemLoader",
    "version": "1.3.2",
    "project_urls": {
        "Documentation": "https://itemloaders.readthedocs.io/",
        "Homepage": "https://github.com/scrapy/itemloaders",
        "Source": "https://github.com/scrapy/itemloaders"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d5689592dcfd9c24467b545fac17b098a171e372bf0d775400fa1971712bca57",
                "md5": "346c3cb185c154eea704febe3c1dd648",
                "sha256": "6a91465f721c7bad8b07e1fbb0560cf99f4845156ed9f7bf2ca424336c6a677c"
            },
            "downloads": -1,
            "filename": "itemloaders-1.3.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "346c3cb185c154eea704febe3c1dd648",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 12194,
            "upload_time": "2024-09-30T13:48:47",
            "upload_time_iso_8601": "2024-09-30T13:48:47.820009Z",
            "url": "https://files.pythonhosted.org/packages/d5/68/9592dcfd9c24467b545fac17b098a171e372bf0d775400fa1971712bca57/itemloaders-1.3.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b63ec549370e95c9dc7ec5e155c075e2700fa75abe5625608a4ce5009eabe0bf",
                "md5": "07e11fabfc7d85ff84d6e22abcb26eb5",
                "sha256": "4faf5b3abe83bf014476e3fd9ccf66867282971d9f1d4e96d9a61b60c3786770"
            },
            "downloads": -1,
            "filename": "itemloaders-1.3.2.tar.gz",
            "has_sig": false,
            "md5_digest": "07e11fabfc7d85ff84d6e22abcb26eb5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 19707,
            "upload_time": "2024-09-30T13:48:49",
            "upload_time_iso_8601": "2024-09-30T13:48:49.417415Z",
            "url": "https://files.pythonhosted.org/packages/b6/3e/c549370e95c9dc7ec5e155c075e2700fa75abe5625608a4ce5009eabe0bf/itemloaders-1.3.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-30 13:48:49",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "scrapy",
    "github_project": "itemloaders",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "itemloaders"
}
        
Elapsed time: 0.86019s