mirror of
https://github.com/spaam/svtplay-dl.git
synced 2024-11-27 21:54:17 +01:00
get_http_data: support for referer-header.
This commit is contained in:
parent
1a58b136ee
commit
f1ff63fa4f
@ -268,7 +268,7 @@ def decode_f4f(fragID, fragData):
|
||||
start += tagLen + 11 + 4
|
||||
return start
|
||||
|
||||
def get_http_data(url, method="GET", header="", data=""):
|
||||
def get_http_data(url, method="GET", header="", data="", referer=None):
|
||||
""" Get the page to parse it for streams """
|
||||
request = Request(url)
|
||||
request.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
|
||||
@ -277,6 +277,8 @@ def get_http_data(url, method="GET", header="", data=""):
|
||||
request.add_header('Content-Type', header)
|
||||
if len(data) > 0:
|
||||
request.add_data(data)
|
||||
if referer:
|
||||
request.add_header('Referer', referer)
|
||||
try:
|
||||
response = urlopen(request)
|
||||
except HTTPError as e:
|
||||
|
Loading…
Reference in New Issue
Block a user