0

I have a video in a url, that I want download it using Python. The problem here is that when I execute the script and download it, the final file just have 1 kb, it's like never start the process of download.

I tried with this solution that I saw in https://stackoverflow.com/a/16696317/5280246:

    url_video = "https://abiu-tree.fruithosted.net/dash/m/cdtsqmlbpkbmmddq~1504839971~190.52.0.0~w7tv1per/init-a1.mp4"
    rsp = requests.get(url_video, stream=True)
    print("Downloading video...")
    with open("video_test_10.mp4",'wb') as outfile:
        for chunk in rsp.iter_content(chunk_size=1024):
            if chunk:
                outfile.write(chunk)
    rsp.close()

Too I tried like this:

url_video = "https://abiu-tree.fruithosted.net/dash/m/cdtsqmlbpkbmmddq~1504839971~190.52.0.0~w7tv1per/init-a1.mp4"
rsp = requests.get(url_video)
with open("out.mp4",'wb') as f:
     f.write(rsp.content)

I tried too with:

urllib.request.retrieve(url_video, "out.mp4")
Alejoo
  • 13
  • 5
  • The code seems right, I use wget to download the video, I get a file less than 1kb. So I think there are something wrong with the url and you should change another url. – Philokey Sep 07 '17 at 06:47
  • something is wrong with url.! – Anurag Misra Sep 07 '17 at 07:11
  • You shoud probably check the response status_code, content_type and content... Just because `request.get()` didn't raised doesn't mean you got the expected response, you could as well get a 4XX or 5XX response. – bruno desthuilliers Sep 07 '17 at 07:38

0 Answers0