diff options
author | Nitzo <nitzo2001@yahoo.com> | 2016-05-20 22:25:53 +0200 |
---|---|---|
committer | Nitzo <nitzo2001@yahoo.com> | 2016-05-20 22:25:53 +0200 |
commit | b94cd8bb12c1ebeda2e272791376de390b9f7fe6 (patch) | |
tree | b8e2eac1e0a3f013c4cc5803d001ea43126fdd55 /module | |
parent | Merge pull request #2468 from OndrejIT/stable (diff) | |
download | pyload-b94cd8bb12c1ebeda2e272791376de390b9f7fe6.tar.xz |
[New hoster] HearthisAt - fix #2467
Diffstat (limited to 'module')
-rw-r--r-- | module/plugins/hoster/HearthisAt.py | 43 |
1 files changed, 43 insertions, 0 deletions
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 |