{"id":19900018,"url":"https://github.com/scrapy-plugins/scrapy-streamitem","last_synced_at":"2025-05-02T22:32:06.772Z","repository":{"id":24985210,"uuid":"28403727","full_name":"scrapy-plugins/scrapy-streamitem","owner":"scrapy-plugins","description":"Scrapy support for working with streamcorpus Stream Items.","archived":false,"fork":false,"pushed_at":"2015-01-07T16:26:59.000Z","size":860,"stargazers_count":11,"open_issues_count":0,"forks_count":4,"subscribers_count":56,"default_branch":"master","last_synced_at":"2025-04-07T08:02:05.231Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scrapy-plugins.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-12-23T15:01:22.000Z","updated_at":"2024-03-14T06:47:19.000Z","dependencies_parsed_at":"2022-08-23T15:31:01.464Z","dependency_job_id":null,"html_url":"https://github.com/scrapy-plugins/scrapy-streamitem","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scrapy-plugins%2Fscrapy-streamitem","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scrapy-plugins%2Fscrapy-streamitem/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scrapy-plugins%2Fscrapy-streamitem/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scrapy-plugins%2Fscrapy-streamitem/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scrapy-plugins","download_url":"https://codeload.github.com/scrapy-plugins/scrapy-streamitem/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252116449,"owners_count":21697381,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T20:10:51.314Z","updated_at":"2025-05-02T22:32:05.393Z","avatar_url":"https://github.com/scrapy-plugins.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"=================\nscrapy-streamitem\n=================\n\n.. image:: https://badge.fury.io/py/scrapy-streamitem.png\n   :target: http://badge.fury.io/py/scrapy-streamitem\n\n.. image:: https://api.travis-ci.org/scrapinghub/scrapy-streamitem.png?branch=master\n   :target: http://travis-ci.org/scrapinghub/scrapy-streamitem\n\nOverview\n========\n\nScrapy support for working with streamcorpus_ StreamItems_.\n\nIncludes the following:\n\n- **StreamItem**: Scrapy Stream Item definition. ``streamitem.items.StreamItem``\n- **StreamItemLoader**: Scrapy Itemloader for ``StreamItem``. ``streamitem.loaders.StreamItemLoader``\n- **StreamItemExporter**: Scrapy ItemExporter to .sc file. ``streamitem.exporters.StreamItemExporter``\n- **StreamItemFileFeedStorage**: Scrapy FileFeedStorage to handle .sc files. ``streamitem.storages.StreamItemFileFeedStorage``\n\nStream Items\n============\n\nScrapy Stream Item will be populated from response with the following fields:\n\n- **url**: A string containing the URL of the response.\n- **body**: A string containing the body of this Response. \n- **source_url**: If response has been redirected, a string containing the URL of the original page. Defaults to None.\n- **redirect_urls**: If response has been redirected, a list containing the URLs of all the redirected pages, including the current one. Defaults to None.\n- **http_status**: An integer representing the HTTP status of the response. Example: 200, 404.\n- **content_type**: A string containing the Content-Type HTTP header of the response.\n- **response_size**: An integer representing the response body size in bytes.\n- **metadata**: A dict containing arbitrary metadata for this page.\n\nIf items are exported they will generate streamcorpus StreamItem_ items filling the following fields:\n\n- **abs_url**: item.url\n- **source_url**: item.source_url\n- **body.raw**: item.body\n- **body.media_type**: item.content_type\n- **body.language.code**: item.metadata.language_code\n- **body.language.name**: item.metadata.language_name\n- **source_metadata['redirect_urls']**: item.redirect_urls\n- **source_metadata['response_size']**: item.response_size\n- **source_metadata**: will be filled with all fields in item.metadata\n\nHow to use it\n=============\n\nAn example of use from a spider::\n\n    def parse_page(self, response):\n        loader = StreamItemLoader(item=StreamItem(), response=response)\n        return loader.load_item()\n\nSettings for exporting::\n\n    FEED_URI = \".exports/streamitems.sc\"\n    FEED_FORMAT = \"streamcorpus\"\n    FEED_EXPORTERS = {\n        'streamcorpus': 'scrapylib.streamitem.exporters.StreamItemExporter',\n    }\n    FEED_STORAGES = {\n        '': 'scrapylib.streamitem.storages.StreamItemFileFeedStorage',\n    }\n    \nYou can also add additional info to your item using the ``metadata`` field.\nFor example from a Item pipeline::\n\n    def process_item(self, item, spider):\n         item['metadata']['my_custom_field'] = 'whatever'\n         return item\n\n\nRequirements\n============\n\n* Scrapy_ \u003e= 0.22.0\n* streamcorpus_\n\nInstall\n=======\n\nusing pypi::\n\n   pip install scrapy-streamitem\n\n\n.. _streamcorpus: https://github.com/trec-kba/streamcorpus\n.. _StreamItem: http://streamcorpus.org/sphinx-docs/streamcorpus.html#stream-items\n.. _StreamItems: http://streamcorpus.org/sphinx-docs/streamcorpus.html#stream-items\n.. _Scrapy: https://github.com/scrapinghub/scrapy\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscrapy-plugins%2Fscrapy-streamitem","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscrapy-plugins%2Fscrapy-streamitem","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscrapy-plugins%2Fscrapy-streamitem/lists"}