|
|
@ -36,12 +36,12 @@ class SVT(Channel):
|
|
|
|
published_parsed: datetime = datetime.now()
|
|
|
|
published_parsed: datetime = datetime.now()
|
|
|
|
video_id = str()
|
|
|
|
video_id = str()
|
|
|
|
|
|
|
|
|
|
|
|
if svt_id == 'feed':
|
|
|
|
if self.m_id == 'feed':
|
|
|
|
feed = feedparser.parse(self.get_feed())
|
|
|
|
feed = feedparser.parse(self.get_feed())
|
|
|
|
entries = feed['entries']
|
|
|
|
entries = feed['entries']
|
|
|
|
for entry in entries:
|
|
|
|
for entry in entries:
|
|
|
|
video_id = hash_string(entry['id'])
|
|
|
|
video_id = hash_string(entry['id'])
|
|
|
|
if video_exists(video_id, svt_id):
|
|
|
|
if video_exists(video_id, self.m_id):
|
|
|
|
break
|
|
|
|
break
|
|
|
|
for link in entry['links']:
|
|
|
|
for link in entry['links']:
|
|
|
|
if str(link['type']).startswith('image/'):
|
|
|
|
if str(link['type']).startswith('image/'):
|
|
|
@ -56,9 +56,9 @@ class SVT(Channel):
|
|
|
|
datart = element.get('data-rt')
|
|
|
|
datart = element.get('data-rt')
|
|
|
|
|
|
|
|
|
|
|
|
if datart == 'top-area-play-button':
|
|
|
|
if datart == 'top-area-play-button':
|
|
|
|
svt_id = href.split('=')[1].split('&')[0]
|
|
|
|
self.m_id = href.split('=')[1].split('&')[0]
|
|
|
|
|
|
|
|
|
|
|
|
resolved_link = resolve_link(svt_id)
|
|
|
|
resolved_link = self.resolve_link()
|
|
|
|
description = str(entry['description'])
|
|
|
|
description = str(entry['description'])
|
|
|
|
published_parsed = entry['published_parsed']
|
|
|
|
published_parsed = entry['published_parsed']
|
|
|
|
title = str(entry['title'])
|
|
|
|
title = str(entry['title'])
|
|
|
@ -68,12 +68,12 @@ class SVT(Channel):
|
|
|
|
item = Item(description, resolved_link, self.m_provider_name,
|
|
|
|
item = Item(description, resolved_link, self.m_provider_name,
|
|
|
|
published_parsed, thumbnail, title)
|
|
|
|
published_parsed, thumbnail, title)
|
|
|
|
self.m_items.append(item)
|
|
|
|
self.m_items.append(item)
|
|
|
|
add_video(video_id, svt_id, self.m_provider_name, description,
|
|
|
|
add_video(video_id, self.m_id, self.m_provider_name, description,
|
|
|
|
resolved_link, published_parsed, thumbnail, title, 0)
|
|
|
|
resolved_link, published_parsed, thumbnail, title, 0)
|
|
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
chan_dict = resolve_svt_channel(svt_id)
|
|
|
|
chan_dict = resolve_svt_channel(self.m_id)
|
|
|
|
resolved_link = resolve_link(svt_id)
|
|
|
|
resolved_link = self.resolve_link()
|
|
|
|
video_id = hash_string(resolved_link)
|
|
|
|
video_id = hash_string(resolved_link)
|
|
|
|
title = chan_dict['name']
|
|
|
|
title = chan_dict['name']
|
|
|
|
description = "Live channel stream"
|
|
|
|
description = "Live channel stream"
|
|
|
@ -85,9 +85,9 @@ class SVT(Channel):
|
|
|
|
self.m_items.append(item)
|
|
|
|
self.m_items.append(item)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def resolve_link(svt_id: str) -> str:
|
|
|
|
def resolve_link(self) -> str:
|
|
|
|
api = json.loads(
|
|
|
|
api = json.loads(
|
|
|
|
requests.get('https://api.svt.se/video/{}'.format(svt_id)).text)
|
|
|
|
requests.get('https://api.svt.se/video/{}'.format(self.m_id)).text)
|
|
|
|
resolved_link = ''
|
|
|
|
resolved_link = ''
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|