+ 2

How can I find my downloaded PDF?

import os import requests from urllib.parse import urljoin from bs4 import BeautifulSoup url="http://www.gatsby.ucl.ac.uk/teaching/courses/ml1-2016.html" #If there is no such folder, the script will create one automatically folder_location = r'E:\webscraping' if not os.path.exists(folder_location):os.mkdir(folder_location) response = requests.get(url) soup= BeautifulSoup(response.text, "html.parser") for link in soup.select("a[href$='.pdf']"): #Name the pdf files using the last portion of each link which are unique in this case filename =os.path.join(folder_location,link['href'].split('/')[-1]) with open(filename, 'wb') as f: f.write(requests.get(urljoin(url,link['href'])).content)

1st Feb 2021, 2:42 AM
Ujjawal Gupta
Ujjawal Gupta - avatar
5 Respuestas
+ 2
Your file would be saved in E drive under a folder named "webscraping" Check the value in "folder_location" variable right in the beginning of the script. It's weird how you yourself defined it in the beginning and forgot about it 🤔
1st Feb 2021, 4:05 AM
Arsenic
Arsenic - avatar
+ 4
Can you, yourself read this code ?
1st Feb 2021, 3:14 AM
Arsenic
Arsenic - avatar
+ 4
Arsenic lmao 🤣
1st Feb 2021, 3:29 AM
Alphin K Sajan
Alphin K Sajan - avatar
+ 3
Ok wait
1st Feb 2021, 3:39 AM
Ujjawal Gupta
Ujjawal Gupta - avatar
+ 1
So where can I find my downloaded pdf
1st Feb 2021, 1:11 PM
Ujjawal Gupta
Ujjawal Gupta - avatar