0

A friend told me that when he entered the following website:
http://tatoochange.com/watch/OGgmlnav-joe-gould-s-secret/vip.html

He noticed that when he played the video, on Fiddler he saw the path of the file (http://85.217.223.24/vids/joe_goulds_secret_2000.mp4):
enter image description here

So he tried to download it from the browser but he received an error:
enter image description here

I checked the GET request with Burpe when playing the video:

GET /vids/joe_goulds_secret_2000.mp4 HTTP/1.1
Host: 85.217.223.24
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0
Accept: video/webm,video/ogg,video/*;q=0.9,application/ogg;q=0.7,audio/*;q=0.6,*/*;q=0.5
Accept-Language: en-US,en;q=0.5
Referer: http://entervideo.net/watch/3accec760b23ad4
Range: bytes=0-
Connection: close

I converted it to python script:

import requests

session = requests.Session()

headers = {"Accept":"video/webm,video/ogg,video/*;q=0.9,application/ogg;q=0.7,audio/*;q=0.6,*/*;q=0.5","User-Agent":"Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0","Referer":"http://entervideo.net/watch/3accec760b23ad4","Connection":"close","Accept-Language":"en-US,en;q=0.5","Range":"bytes=0-"}
response = session.get("http://85.217.223.24/vids/joe_goulds_secret_2000.mp4", headers=headers)

print("Status code:   %i" % response.status_code)
print("Response body: %s" % response.content)

When I run it, it his hanging.
I don't have any idea if download it or not.

My question is, why I can't download it from the browser just by accessing it ?
Second, even when I am using the script which is not getting any error, it hangs...

E235
  • 11,560
  • 24
  • 91
  • 141

2 Answers2

1

Using sessions.get is not advisable to download a large file. This would primarily be used for a web call that receives a json or xml list. To download large files you should follow the method shown in this thread:

Download large file in python with requests

Joe6.626070
  • 321
  • 1
  • 9
0

I managed to do it.
Need to notice that the response was 206 which is a partial content.

The solution:

import os,requests
def download():
    headers = {"Accept": "video/webm,video/ogg,video/*;q=0.9,application/ogg;q=0.7,audio/*;q=0.6,*/*;q=0.5",
               "User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0",
               "Referer": "http://entervideo.net/watch/3accec760b23ad4", "Connection": "close",
               "Accept-Language": "en-US,en;q=0.5", "Range": "bytes=0-"}
    get_response = requests.get("http://85.217.223.24/vids/joe_goulds_secret_2000.mp4", headers=headers,stream=True)
    #file_name  = url.split("/")[-1]
    file_name = r'c:\tmp\joe_goulds_secret_2000.mp4'
    with open(file_name, 'wb') as f:
        count = 0
        for chunk in get_response.iter_content(chunk_size=1024):
            print('chunk: ' + str(count))
            count += 1
            if chunk: # filter out keep-alive new chunks
                f.write(chunk)

download()
E235
  • 11,560
  • 24
  • 91
  • 141