1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-28 06:04:17 +01:00

svtplay: Add support for tabs and --include-clips

svtplay: Adds support for --include-clips as well as support to just download one tab of episodes by using ?tab="tab" in url. 
This should fix https://github.com/spaam/svtplay-dl/issues/549, https://github.com/spaam/svtplay-dl/issues/514 and https://github.com/spaam/svtplay-dl/issues/480
This commit is contained in:
qnorsten 2017-02-02 15:57:52 +01:00
parent ac864643cd
commit c781bd1bb8

View File

@ -143,6 +143,7 @@ class Svtplay(Service, OpenGraphThumbMixin):
if match is None:
videos = []
tab = None
match = re.search("__svtplay'] = ({.*});", self.get_urldata())
if re.search("sista-chansen", parse.path):
videos = self._last_chance(videos, 1)
@ -154,13 +155,33 @@ class Svtplay(Service, OpenGraphThumbMixin):
if re.search("/genre", parse.path):
videos = self._genre(dataj)
else:
if parse.query:
match = re.search("tab=(.+)",parse.query)
if(match):
tab = match.group(1)
items = dataj["videoTitlePage"]["relatedVideosTabs"]
for i in items:
if "sasong" in i["slug"] or "senast" in i["slug"]:
for n in i["videos"]:
parse = urlparse(n["contentUrl"])
if parse.path not in videos:
videos.append(parse.path)
if tab:
if i["slug"] == tab:
for n in i["videos"]:
parse = urlparse(n["contentUrl"])
if parse.path not in videos:
videos.append(parse.path)
else:
if "sasong" in i["slug"] or "senast" in i["slug"]:
for n in i["videos"]:
parse = urlparse(n["contentUrl"])
if parse.path not in videos:
videos.append(parse.path)
if self.options.include_clips:
if i["slug"] == "klipp":
for n in i["videos"]:
parse = urlparse(n["contentUrl"])
if parse.path not in videos:
videos.append(parse.path)
episodes = [urljoin("http://www.svtplay.se", x) for x in videos]
else: