Reputation: 141
I have wget downloaded in the folder, and I run the following command:
wget.exe -i link_goes_here.mp4 -c -nc -P "K:\Folder\of\Saved\videos"
Is there any way to have this run inside a Python script so I don't have to manually run this command? I have a Python script that has:
print(link)
I'm wondering if there is any way to have the wget perform its download after that print occurs?
Here is the script I am working with:
while True:
try:
file=open('recent.txt','a', buffering=1)
try:
response=[]
response=requests.get(API_link,proxies=proxies,headers=headers).text.split('[')[1].split(']')[0]
response=response.split(',')
for i in response:
temp=''
temp=i.split('"')[1].split('"')[0]
if temp not in list_:
link=''
link=starting_part+temp+".mp4"
print(link)
file.write(link)
file.write('\n')
list_+=[temp]
file.close()
sleep(5)
except:
continue
print(len(list_))
except requests.ConnectionError:
continue
except requests.exceptions.Timeout:
continue
else:
#print('Something happened\n')
continue
Upvotes: 1
Views: 862
Reputation: 33
Just like @Quintin said
import subprocess
command = ["wget.exe", "-i", link, "-c", "-nc", '"K:\Folder\of\Saved\videos"']
print(link)
process = subprocess.Popen(command)
but instead use link after the -i.
Upvotes: 1
Reputation: 125
If I understand you type that command into a command line. you can use the subprocess library to do this.
import subprocess
command = ["wget.exe", "-i", "https://link.com/video.mp4", "-c", "-nc", '"K:\Folder\of\Saved\videos"']
print(link)
process = subprocess.Popen(command)
I believe this is what your asking if not tell me and I can help :)
Upvotes: 2