1
0
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:
Johan Andersson 2013-03-05 23:34:03 +01:00
parent 1a58b136ee
commit f1ff63fa4f

View File

@ -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: