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
  How can I make this Python script add a limit to trades made with API? streetlaw 0 55 Oct-12-2018, 11:41 AM
Last Post: streetlaw
  How can read and download the attachment from the mail using while loop in IMAPlib Py Samjith 0 44 Oct-11-2018, 07:15 AM
Last Post: Samjith
  using a shell script within python Krszt 2 85 Oct-10-2018, 11:00 AM
Last Post: snippsat
  download file from google drive .. evilcode1 7 148 Sep-21-2018, 06:13 PM
Last Post: evilcode1
  help about requests download ggbaby 1 83 Sep-18-2018, 03:44 AM
Last Post: wavic
  Download multiple images with one click andie31 0 119 Sep-13-2018, 10:37 AM
Last Post: andie31
  Download multiple images and rename them andie31 4 185 Sep-13-2018, 10:26 AM
Last Post: andie31
  run scapy from python script .. evilcode1 13 291 Sep-13-2018, 01:45 AM
Last Post: ichabod801
  Python script runs on startup but does not register keystrokes. mericanpi 3 170 Sep-07-2018, 02:58 PM
Last Post: mericanpi
  shell script inside python pannis 6 208 Sep-05-2018, 06:05 AM
Last Post: pannis

Forum Jump:


Users browsing this thread: 1 Guest(s)