1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-24 04:05:39 +01:00

urplay: support for -A on urskola.se

fixes #677
This commit is contained in:
Johan Andersson 2017-09-16 17:36:37 +02:00
parent 5057322c85
commit 0ddbc9752e

View File

@ -66,17 +66,30 @@ class Urplay(Service, OpenGraphThumbMixin):
def find_all_episodes(self, options): def find_all_episodes(self, options):
parse = urlparse(self.url) parse = urlparse(self.url)
match = re.search("/program/\d+-(\w+)-", parse.path)
if not match:
log.error("Can't find any videos")
return None
keyword = match.group(1)
episodes = [] episodes = []
all_links = re.findall('card-link" href="([^"]+)"', self.get_urldata())
for i in all_links: if parse.netloc == "urskola.se":
match = re.search("/program/\d+-(\w+)-", i) data = self.get_urldata()
if match and match.group(1) == keyword: match = re.search('data-limit="[^"]+" href="([^"]+)"', data)
episodes.append(urljoin("http://urplay.se/", i)) if match:
res = self.http.get(urljoin("http://urskola.se", match.group(1)))
data = res.text
tags = re.findall('<a class="puff tv video" title="[^"]+" href="([^"]+)"', data)
for i in tags:
url = urljoin("http://urskola.se/", i)
if url not in episodes:
episodes.append(url)
else:
match = re.search("/program/\d+-(\w+)-", parse.path)
if not match:
log.error("Can't find any videos")
return None
keyword = match.group(1)
all_links = re.findall('card-link" href="([^"]+)"', self.get_urldata())
for i in all_links:
match = re.search("/program/\d+-(\w+)-", i)
if match and match.group(1) == keyword:
episodes.append(urljoin("http://urplay.se/", i))
episodes_new = [] episodes_new = []
n = 0 n = 0