Home>

Hello everyone. Tell me, what are the tools or ways to download a file from a link with a restriction using python?

I tried

wget.download(url, name)

Console output

13% [......... ] 78643200 /595294094

Also used

data= urlopen(list_url_video[0])
open('video.mp4', 'wb') as file:
    file.write(data)

Console output

TypeError: a bytes-like object is required, not 'HTTPResponse'

Well,

response= requests.get(url=url, stream=True)
open('video.mp4', 'wb') as file:
    for chunk in response.iter_content(chunk_size=1024 * 1024):
        if chunk:
            file.write(chunk)

The file has been written to.mp4format and weighs 75.0 MB

Oh yes, I used this approach too

name= 'video.mp4'
urlretrieve(url, name)

The file has been written to.tmpformat and weighs 75.0 MB

None of this worked

What is the link that is displayed in the console?

Александр2022-01-21 15:31:31

None of this worked, and will not work with this approach.

Александр2022-01-21 15:31:56

What are the restrictions?

Александр2022-01-21 15:32:27

@Alexander Added to the question, output to the console. Restriction -I mean traffic restrictions on downloading a file from the server (75.0 MB).

GRuler2022-01-21 15:58:14

How can the community help you?

Александр2022-01-21 16:22:42