I'm trying to extract an image from a website using python

72 Views Asked by At

I need to extract or "scrape" a specific image source off of a website using nothing but the url that the image is being hosted on.

For example (and experimental purposes), I would like the source of an image from this url:

https://store.creality.com/ca/products/halot-mage-8k-resin-3d-printer

The output should look like this:

//img.fantaskycdn.com/5cd05e087233e44f5cf2bcce0b9e3d62_750x.jpg

I would also like to note that this code should work on the same domain using a different path, for example here's the second url:

https://store.creality.com/ca/products/uw-02-washing-curing-machine

And here's the output using the same code as before:

//img.fantaskycdn.com/95b15b3da2894f39f5a70714a6b5b6a1_750x.jpg

I've tried searching stack exchange but the solutions i've found either dont work on my end, or dont work because it is searching for something that is said to be unexistant.

Sometimes i get the "Error 403: Forbidden" message which could mean that the website im scraping doesnt want me accessing its sources without doing so manually, or something else I dont know.

Even extracting the line of code that the image is buried in would be a massive improvement, anywhere closer to the desired output will be considered a temporary solution.

0

There are 0 best solutions below