Python Forum
Python script batch download and batch rename
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python script batch download and batch rename
#1
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 Smile
Reply
#2
you can use requests.get
Reply
#3
Thanks, can you send me a simple because I am very new with Python,

Thanks in advance
Reply
#4
(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())
Output:
http://www.example.com/ http://www.example.com/some-URL/
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Is there a *.bat DOS batch script to *.py Python Script converter? pstein 3 3,004 Jun-29-2023, 11:57 AM
Last Post: gologica
  python multiprocessing to download sql table mg24 5 1,407 Oct-31-2022, 03:53 PM
Last Post: Larz60+
  batch file for running python scipt in Windows shell MaartenRo 2 1,824 Jan-21-2022, 02:36 PM
Last Post: MaartenRo
  download with internet download manager coral_raha 0 2,880 Jul-18-2021, 03:11 PM
Last Post: coral_raha
  download pubmed PDFs using pubmed2pdf in python Wooki 8 5,368 Oct-19-2020, 03:06 PM
Last Post: jefsummers
  How to run script from batch file? jmair 1 4,214 Oct-12-2020, 04:29 PM
Last Post: jmair
  python script to Batch File biprabu 1 2,011 Sep-09-2020, 01:49 PM
Last Post: jefsummers
  How can I download Python files from GitHub? bitcoin10mil 2 2,767 Aug-26-2020, 09:03 PM
Last Post: Axel_Erfurt
  How to kill a bash script running as root from a python script? jc_lafleur 4 5,788 Jun-26-2020, 10:50 PM
Last Post: jc_lafleur
  crontab on RHEL7 not calling python script wrapped in shell script benthomson 1 2,247 May-28-2020, 05:27 PM
Last Post: micseydel

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020