From b94cd8bb12c1ebeda2e272791376de390b9f7fe6 Mon Sep 17 00:00:00 2001 From: Nitzo Date: Fri, 20 May 2016 23:25:53 +0300 Subject: [New hoster] HearthisAt - fix #2467 --- module/plugins/hoster/HearthisAt.py | 43 +++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 module/plugins/hoster/HearthisAt.py diff --git a/module/plugins/hoster/HearthisAt.py b/module/plugins/hoster/HearthisAt.py new file mode 100644 index 000000000..d0b76d806 --- /dev/null +++ b/module/plugins/hoster/HearthisAt.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- + +import re + +from module.plugins.internal.misc import json +from module.plugins.internal.Hoster import Hoster + + + +class HearthisAt(Hoster): + __name__ = "HearthisAt" + __type__ = "hoster" + __version__ = "0.01" + __status__ = "testing" + + __pattern__ = r'https?://(?:www\.)?hearthis\.at/' + __config__ = [("activated", "bool", "Activated", True)] + + __description__ = """Hearthis.at hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("GammaC0de", "nitzo2001{AT]yahoo{DOT]com")] + + + def setup(self): + self.multiDL = True + + + def process(self, pyfile): + html = self.load(pyfile.url) + + m = re.search(r'intTrackId = (\d+);', html) + if m is None: + self.fail(_("Track ID not found")) + + track_id = m.group(1) + + data = self.load("https://hearthis.at/playlist.php", + post={'tracks[]': track_id}) + json_data = json.loads(data) + + pyfile.name = json_data[0]['title'] + ".mp3" + + self.download(json_data[0]['track_url']) \ No newline at end of file -- cgit v1.2.3