Closed Matteoo98 closed 3 years ago
Hello!
That's a feature I've been planning but haven't gotten around to yet; I just went and looked at the JSON served back from a post with multiple images and it is certainly possible to scrape. I'll bump this to the top of the priority list and have it released sometime in the next few days as a new feature with the next minor version release!
In the meantime, when you want URL's for every image in the post you can use this function:
def get_image_urls(post):
"""Returns a list of URLs for all images in a scraped Post object"""
image_urls = {key: val for key,val in post.flat_json_dict.items() if "display_url" in key}
return list(set(image_urls.values()))
Scrape a post like you normally would and then pass it as an argument to get_image_urls
, this will return a list of all the URLs in the post.
Hope this helps!
Thank you very much you helped me a lot
Hi, i'm using using your library and i really love your work. I have a question regarding the post scraping, when i scarpe a post it shows me all the informations related but for the images only a link of the first picture of the post, but often the posts has many pictures in a post. How can i obtain from a post all links to all the picture inside it and not only the first ?