Aug-22-2020, 06:35 AM
Hey! Friends.
Problem: How to get extension of the file from url or else anything using request or any module?
Another Problem: Can I Use To Split Files In Python And Download Them Using Threading?
Here Is The Code:
Problem: How to get extension of the file from url or else anything using request or any module?
Another Problem: Can I Use To Split Files In Python And Download Them Using Threading?
Here Is The Code:
import requests import threading def download(url): r = requests.get(url, allow_redirects=True) response = requests.get(url, stream = True) text_file = open("data.html","wb") for chunk in response.iter_content(chunk_size=1024): text_file.write(chunk) #writing one chunk at a time to text file text_file.close() t = threading.Thread(target=download,args=('https://youtu.be/zcywDfl7vJs',)) t.start()