Yield multiple items using scrapy

前端 未结 1 484
旧巷少年郎
旧巷少年郎 2021-01-06 09:20

I\'m scraping data from the following URL:
http://www.indexmundi.com/commodities/?commodity=gasoline

There are two sections which contain price: Gulf C

1条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-06 09:58

    It should work just fine. You can yield as many items from a parse callback as you need. Just some notes:

    1. In the second case it's better to create a new item then reusing the old one. Because you never know what has happened to the old item reference. Maybe you are overwriting and losing the previous data.

    2. You can create different item types for your two cases. And in the pipeline treat them differently.

    0 讨论(0)
提交回复
热议问题