/module/plugins/hoster/NowDownloadEu.py

https://bitbucket.org/spoob/pyload · Python · 62 lines · 37 code · 8 blank · 17 comment · 4 complexity · b64bc29bb82ac36e8306980b439b9cee MD5 · raw file

  1. # -*- coding: utf-8 -*-
  2. """
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 3 of the License,
  6. or (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. See the GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, see <http://www.gnu.org/licenses/>.
  13. @author: zoidberg
  14. """
  15. import re
  16. from random import random
  17. from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
  18. class NowDownloadEu(SimpleHoster):
  19. __name__ = "NowDownloadEu"
  20. __type__ = "hoster"
  21. __pattern__ = r"http://(www\.)?nowdownload\.(eu|co)/dl/(?P<ID>[a-z0-9]+)"
  22. __version__ = "0.01"
  23. __description__ = """NowDownloadEu"""
  24. __author_name__ = ("godofdream")
  25. FILE_INFO_PATTERN = r'Downloading</span> <br> (?P<N>.*) (?P<S>[0-9,.]+) (?P<U>[kKMG])i?B </h4>'
  26. FILE_OFFLINE_PATTERN = r'(This file does not exist!)'
  27. FILE_TOKEN_PATTERN = r'"(/api/token\.php\?token=[a-z0-9]+)"'
  28. FILE_CONTINUE_PATTERN = r'"(/dl2/[a-z0-9]+/[a-z0-9]+)"'
  29. FILE_WAIT_PATTERN = r'\.countdown\(\{until: \+(\d+),'
  30. FILE_DOWNLOAD_LINK = r'"(http://f\d+\.nowdownload\.eu/dl/[a-z0-9]+/[a-z0-9]+/[^<>"]*?)"'
  31. def setup(self):
  32. self.wantReconnect = False
  33. self.multiDL = True
  34. self.chunkLimit = -1
  35. self.resumeDownload = True
  36. def handleFree(self):
  37. tokenlink = re.search(self.FILE_TOKEN_PATTERN, self.html)
  38. continuelink = re.search(self.FILE_CONTINUE_PATTERN, self.html)
  39. if (not tokenlink) or (not continuelink): self.fail('Plugin out of Date')
  40. wait = 60
  41. found = re.search(self.FILE_WAIT_PATTERN, self.html)
  42. if found: wait = int(found.group(1))
  43. self.html = self.load("http://www.nowdownload.eu" + str(tokenlink.group(1)))
  44. self.setWait(wait)
  45. self.wait()
  46. self.html = self.load("http://www.nowdownload.eu" + str(continuelink.group(1)))
  47. url = re.search(self.FILE_DOWNLOAD_LINK, self.html)
  48. if not url: self.fail('Download Link not Found (Plugin out of Date?)')
  49. self.logDebug('Download link: ' + str(url.group(1)))
  50. self.download(str(url.group(1)))
  51. getInfo = create_getInfo(NowDownloadEu)