Cant Download Images from Unsplash Website - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html) +--- Thread: Cant Download Images from Unsplash Website (/thread-32417.html) |
Cant Download Images from Unsplash Website - firaki12345 - Feb-08-2021 Good Evening Everyone So I am trying to download all wallpaper images from unsplash, got their API link from the network tab in Firefox. (It loads only 30 links per page which is fine) EDIT: now I Am getting 30 SAME Images but with different names in my folder. Can Anyone Please Help :) Here is the API link from network Tab: unsplash API link Network Here is my Code: import json import pandas as pd import requests import time with open ("Unsplash.json",encoding="UTF-8") as f: s = json.load(f) U = pd.json_normalize(s) U.rename(columns={'alt_description':'Name','urls.raw':'Links'},inplace=True) Links = U["Links"].tolist() Name = U["Name"].tolist() t1 = time.perf_counter() # 1. Works Fine for Index,l in enumerate(img_url,start = 1): data = requests.get(img_url).content with open ("Unsplash_Pics//" + str(Index) + ".jpg","wb") as f: f.write(data) # 2. i get SAME image 29 times but with different names :( for l in Links: data = requests.get(l).content for name in Name: with open ("Unsplash_Pics//" + str(name) + ".jpg","wb") as f: f.write(data) t2 = time.perf_counter() print(f"Finishes in {t2-t1} Seconds") RE: Cant Download Images from Unsplash Website - buran - Feb-08-2021 cross-posted at StackOverflow. https://stackoverflow.com/q/66101502/4046632 What exactly was not clear, when you were asked to let us know when you do cross-post on other sites? |