![]() |
Python script batch download and batch rename - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Python script batch download and batch rename (/thread-13343.html) |
Python script batch download and batch rename - jkhaksaar - Oct-10-2018 Hello everyone, I have a notepad file with a batch of URLs can somebody tell me how a python script can get the URLs and download them at once, also down of each URL the file name exists so once it is downloaded the file gets automatically rename, and this process must be down for 100 URLs? http://google.com/file/mp4_0 mp4_100 http://google.com/file/mp4_1 mp4_50 This is the concept please help. thanks ![]() RE: Python script batch download and batch rename - Larz60+ - Oct-11-2018 you can use requests.get RE: Python script batch download and batch rename - jkhaksaar - Oct-11-2018 Thanks, can you send me a simple because I am very new with Python, Thanks in advance RE: Python script batch download and batch rename - snippsat - Oct-11-2018 (Oct-11-2018, 10:26 AM)jkhaksaar Wrote: Thanks, can you send me a simple because I am very new with Python,You have to show some effort,we do not write finish solution,but try to help along the way. Can give you some hint to get started. Read url from a text file: import requests with open('url.txt') as f: for url_adress in f: print(url_adress.strip()) Download example:import requests link = 'some url adress' file_name = 'a_url.pdf' with open(file_name, 'wb')as f_out: f_out.write(requests.get(link).content)Rename example in this post |