ı tried diffrent libs to download video from url. But even one of them didnt worked.
Here is the link, that ı trying: https://td-cdn.pw/api.php?download=tikdown.org-42500282235.mp4
If it opened once, it directly asking to download, not like a html video. And ı want to save this video to local folder.
If you guys help me ı would be so proud :) (btw ım freaking ı try to solve it last 4 hours)
There are two steps to getting file downloaded in Python so the process is os independant. I would recommend using inbuilt requests library. We use it to make requests to server and fetch content. Then we write the data into a file in next step.
import requests
URL = "https://td-cdn.pw/api.php?download=tikdown.org-42500282235.mp4"
FILE_TO_SAVE_AS = "myvideo.mp4" # the name you want to save file as
resp = requests.get(URL) # making requests to server
with open(FILE_TO_SAVE_AS, "wb") as f: # opening a file handler to create new file 
    f.write(resp.content) # writing content to file
But this is just a simple example. You can implement other features like try/catch blocks to catch any exceptions or use custom headers while making requests.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With