1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-30 15:14:14 +01:00

Add support for cookies

it works similar to headers
This commit is contained in:
Johan Andersson 2020-09-15 23:43:20 +02:00
parent c5f777b548
commit 1e32678ba9
2 changed files with 6 additions and 0 deletions

View File

@ -25,6 +25,8 @@ class HTTP(Session):
self.proxy = config.get("proxy") self.proxy = config.get("proxy")
if config.get("http_headers"): if config.get("http_headers"):
self.headers.update(self.split_header(config.get("http_headers"))) self.headers.update(self.split_header(config.get("http_headers")))
if config.get("cookies"):
self.cookies.update(self.split_header(config.get("cookies")))
self.headers.update({"User-Agent": FIREFOX_UA}) self.headers.update({"User-Agent": FIREFOX_UA})
def check_redirect(self, url): def check_redirect(self, url):

View File

@ -92,6 +92,9 @@ def parser(version):
general.add_argument( general.add_argument(
"--http-header", dest="http_headers", default=None, metavar="header1=value;header2=value2", help="A header to add to each HTTP request." "--http-header", dest="http_headers", default=None, metavar="header1=value;header2=value2", help="A header to add to each HTTP request."
) )
general.add_argument(
"--cookies", dest="cookies", default=None, metavar="cookie1=value;cookie2=value2", help="A cookies to add to each HTTP request."
)
general.add_argument("--remux", dest="remux", default=False, action="store_true", help="Remux from one container to mp4 using ffmpeg or avconv") general.add_argument("--remux", dest="remux", default=False, action="store_true", help="Remux from one container to mp4 using ffmpeg or avconv")
general.add_argument( general.add_argument(
"--exclude", dest="exclude", default=None, metavar="WORD1,WORD2,...", help="exclude videos with the WORD(s) in the filename. comma separated." "--exclude", dest="exclude", default=None, metavar="WORD1,WORD2,...", help="exclude videos with the WORD(s) in the filename. comma separated."
@ -267,6 +270,7 @@ def parsertoconfig(config, parser):
config.set("get_only_episode_url", parser.get_only_episode_url) config.set("get_only_episode_url", parser.get_only_episode_url)
config.set("ssl_verify", parser.ssl_verify) config.set("ssl_verify", parser.ssl_verify)
config.set("http_headers", parser.http_headers) config.set("http_headers", parser.http_headers)
config.set("cookies", parser.cookies)
config.set("format_preferred", parser.format_preferred) config.set("format_preferred", parser.format_preferred)
config.set("stream_prio", parser.stream_prio) config.set("stream_prio", parser.stream_prio)
config.set("remux", parser.remux) config.set("remux", parser.remux)