{"id":13414800,"url":"https://github.com/scrapy-plugins/scrapy-splitvariants","last_synced_at":"2025-07-15T11:16:33.465Z","repository":{"id":57464735,"uuid":"63614071","full_name":"scrapy-plugins/scrapy-splitvariants","owner":"scrapy-plugins","description":"Scrapy spider middleware to split an item into multiple items using a multi-valued key","archived":false,"fork":false,"pushed_at":"2017-02-08T18:25:48.000Z","size":13,"stargazers_count":20,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-07-06T02:45:06.402Z","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":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scrapy-plugins.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGES.rst","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-07-18T15:18:51.000Z","updated_at":"2023-07-17T17:11:50.000Z","dependencies_parsed_at":"2022-08-31T03:11:27.291Z","dependency_job_id":null,"html_url":"https://github.com/scrapy-plugins/scrapy-splitvariants","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/scrapy-plugins/scrapy-splitvariants","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scrapy-plugins%2Fscrapy-splitvariants","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scrapy-plugins%2Fscrapy-splitvariants/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scrapy-plugins%2Fscrapy-splitvariants/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scrapy-plugins%2Fscrapy-splitvariants/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scrapy-plugins","download_url":"https://codeload.github.com/scrapy-plugins/scrapy-splitvariants/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scrapy-plugins%2Fscrapy-splitvariants/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265430562,"owners_count":23764006,"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-07-30T21:00:36.946Z","updated_at":"2025-07-15T11:16:33.414Z","avatar_url":"https://github.com/scrapy-plugins.png","language":"Python","readme":"====================\nscrapy-splitvariants\n====================\n\n.. image:: https://travis-ci.org/scrapy-plugins/scrapy-splitvariants.svg?branch=master\n    :target: https://travis-ci.org/scrapy-plugins/scrapy-splitvariants\n\n.. image:: https://codecov.io/gh/scrapy-plugins/scrapy-splitvariants/branch/master/graph/badge.svg\n  :target: https://codecov.io/gh/scrapy-plugins/scrapy-splitvariants\n\n\n``SplitVariantsMiddleware`` is a Scrapy spider middleware used to split\nsingle items into multiple items when they have a \"variants\" key with multiple values.\n\n\nExample usage\n=============\n\nLet's assume your spider outputs an item with different size options\n(from an ecommerce website for example)::\n\n    item = {\"id\": 12,\n            \"name\": \"Big chair\",\n            \"variants\": [{\"size\": \"XL\", \"price\": 200, \"currency\": \"USD\"},\n                         {\"size\": \"L\", \"price\": 100, \"currency\": \"USD\"}]}\n\nWhen you enable ``SplitVariantsMiddleware``, this single item will become\n2 items with the different variants values into a different item::\n\n    {\"id\": 12, \"name\": \"Big chair\", \"size\": \"XL\", \"price\": 200, \"currency\": \"USD\"}\n    {\"id\": 12, \"name\": \"Big chair\", \"size\": \"L\", \"price\": 100, \"currency\": \"USD\"}\n\n\nInstallation\n============\n\nInstall scrapy-splitvariants using ``pip``::\n\n    $ pip install scrapy-splitvariants\n\n\nConfiguration\n=============\n\n1. Add ``SplitVariantsMiddleware`` by including it in ``SPIDER_MIDDLEWARES``\n   in your ``settings.py`` file::\n\n      SPIDER_MIDDLEWARES = {\n          'scrapy_splitvariants.SplitVariantsMiddleware': 100,\n      }\n\n   Here, priority ``100`` is just an example.\n   Set its value depending on other middlewares you may have enabled already.\n\n2. Enable the middleware using ``SPLITVARIANTS_ENABLED`` set to ``True``\n   in your ``setting.py``.\n","funding_links":[],"categories":["Scrapy Middleware"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscrapy-plugins%2Fscrapy-splitvariants","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscrapy-plugins%2Fscrapy-splitvariants","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscrapy-plugins%2Fscrapy-splitvariants/lists"}