the --source
option.
#22
-
The "A First Scraper" walk-through was pretty good, and using it as a guide, I built a scrapper and chained a few pages together. One point of confusion for me was how to use the scraper once I was done. Using the Is this a design goal? Without it, I'm not as sure how to make this reusable unless it's assumed that I embed spatula inside a Python app. That's fine too. I just couldn't quite get there yet from the docs. Update: I figured out how to bootstrap a starting Page which worked well for me. Sharing here in case it's useful for someone else: class ExamplePage(Page):
source = NullSource()
def process_page(self):
yield PageDetail(source=f"https://example.com/1")
yield PageDetail(source=f"https://example.com/2")
yield PageDetail(source=f"https://example.com/3")
yield PageDetail(source=f"https://example.com/4")
yield PageDetail(source=f"https://example.com/5")
yield PageDetail(source=f"https://example.com/6") |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
I hadn't thought about use cases where the --source option would be useful on the other commands, but I see no reason why it shouldn't be available for others so I've added it in 0.8.1. In the cases where I've needed multiple pages I have used a NullSource too. Great reminder to document that as I get into documenting more of the idioms I've found useful. |
Beta Was this translation helpful? Give feedback.
I hadn't thought about use cases where the --source option would be useful on the other commands, but I see no reason why it shouldn't be available for others so I've added it in 0.8.1.
In the cases where I've needed multiple pages I have used a NullSource too. Great reminder to document that as I get into documenting more of the idioms I've found useful.