[gramofononline] fixes

This commit is contained in:
user706 2019-01-01 17:10:51 +01:00
parent 17961ddf92
commit e0c8ed0696

View File

@ -33,23 +33,13 @@ class GramofonOnlineIE(InfoExtractor):
}] }]
def _get_entry(self, obj): def _get_entry(self, obj):
id1 = obj.get("id") id1 = obj.get('id')
source = obj.get("source") source = obj.get('source')
name = obj.get("name") title = obj.get('name')
artist = obj.get("artist") artist = obj.get('artist')
# subname = obj.get("subname")
# paralelname = obj.get("paralelname")
# record = obj.get("record")
# long1 = obj.get("long")
# genre = obj.get("genre")
# author = obj.get("author")
# state = obj.get("state")
# matrica = obj.get("matrica")
# publisher = obj.get("publisher")
# img = obj.get("img")
return { return {
'id': id1, 'id': id1,
'title': name, 'title': title,
'http_headers': {'Referer': 'https://gramofononline.hu/' + id1}, 'http_headers': {'Referer': 'https://gramofononline.hu/' + id1},
'artist': artist, 'artist': artist,
'thumbnail': 'https://gramofononline.hu/getImage.php?id=' + source, 'thumbnail': 'https://gramofononline.hu/getImage.php?id=' + source,
@ -66,18 +56,10 @@ class GramofonOnlineIE(InfoExtractor):
video_id = self._match_id(url) video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id) webpage = self._download_webpage(url, video_id)
for line in webpage.split("\n"): m = re.search(r'var\s+trackList\s*=\s*(\[.*\]);', webpage)
m = re.search(r'var\s+trackList\s*=\s*(\[.*\]);?\s*', line)
if m:
break
lineobjs = json.loads(m.group(1)) lineobjs = json.loads(m.group(1))
if len(lineobjs) > 1: return {
result = {
'_type': 'playlist', '_type': 'playlist',
'entries': [self._get_entry(obj) for obj in lineobjs] 'entries': [self._get_entry(obj) for obj in lineobjs]
} }
else:
result = self._get_entry(lineobjs[0])
return result