David
David

Reputation: 420

Is it possible to download an image file using the dryscape Python module?

I am trying to use dryscrape to scrape a web page, but is possible to save a particular image from page? It is a normal <img> tag.

Upvotes: 0

Views: 237

Answers (2)

Haroon Amjad
Haroon Amjad

Reputation: 1

Yes you can download image with Dryscrape like that

img_url = sess.xpath("//img")[0]['href']
sess.visit(img_url)
sess.render("image.png")

Try this

Upvotes: 0

Al Sweigart
Al Sweigart

Reputation: 12969

From looking at the documentation at https://dryscrape.readthedocs.io/, it does not look like dryscrape supports downloading files. You will have to use a module such as Requests to do this.

Upvotes: 0

Related Questions