Bottom Page

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
Quote
#2
you can use requests.get
Quote
#3
Thanks, can you send me a simple because I am very new with Python,

Thanks in advance
Quote
#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
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Run Python Script From My VPS? digitalmatic7 1 25 Yesterday, 10:09 PM
Last Post: metulburr
  running python script from shell invoked with os.system("x-terminal-emulator -e /bin/ markhaus 1 28 Yesterday, 09:56 PM
Last Post: Larz60+
  Executing python script from SQL Server agent job getting error msavoy 1 83 Feb-15-2019, 08:37 PM
Last Post: Larz60+
  Download article without photo caption Helene_python 2 85 Feb-14-2019, 01:13 PM
Last Post: snippsat
  Download multiple large json files at once halcynthis 0 42 Feb-14-2019, 08:41 AM
Last Post: halcynthis
  Import Library but Download first? OscarBoots 15 508 Feb-07-2019, 03:07 AM
Last Post: snippsat
  Download data from webpage after POST request AlDe 0 64 Feb-02-2019, 06:26 AM
Last Post: AlDe
  run setup.exe from python script with special parameters asheru93 0 72 Feb-01-2019, 03:11 PM
Last Post: asheru93
  How to rename Network Interface name aniyanetworks 7 173 Jan-30-2019, 06:12 PM
Last Post: aniyanetworks
  Integrating Python Script for Android App everythingisenergy 0 75 Jan-15-2019, 07:39 PM
Last Post: everythingisenergy

Forum Jump:


Users browsing this thread: 1 Guest(s)