Closed wassupluke closed 9 months ago
Hey @wassupluke - OK, I think I see what you mean - could you confirm that recipe.canonical_url()
isn't what you're after here?
Maybe something like recipe.requested_url()
would be it? (so for recipe = scrape_me(url)
, recipe.requested_url() == url
)
Oh that's it! Can we add that info to the README for others to find?
Sure thing - done! Note that canonical_url
isn't guaranteed to be available - for some websites it isn't available in the HTML. So, depending on how you're using it, and for which sites, you might be OK with that, or there could be some edge cases.
When using your code in my project I'm running into a situation where it would be gloriously helpful to have the link that was scraped (the link to the recipe itself) stored in the object for easier retrieval. e.g. I don't want to have to make another list just to keep track of what object belongs to what link, I want to be able to pull the link right from the object.