diff --git a/resolv/__init__.py b/resolv/__init__.py index 21ca5d6..90507c7 100644 --- a/resolv/__init__.py +++ b/resolv/__init__.py @@ -25,6 +25,9 @@ def resolve(url): elif re.match("https?:\/\/(www\.)?vidbux\.com\/[a-zA-Z0-9]+", url) is not None: task = resolvers.VidbuxTask(url) return task.run() + elif re.match("https?:\/\/(www\.)?filenuke\.com\/[a-zA-Z0-9]+", url) is not None: + task = resolvers.FilenukeTask(url) + return task.run() elif re.match("https?:\/\/(www\.)?pastebin\.com\/[a-zA-Z0-9]+", url) is not None: task = resolvers.PastebinTask(url) return task.run() diff --git a/resolv/resolvers/__init__.py b/resolv/resolvers/__init__.py index 6c0e8b2..732ff75 100644 --- a/resolv/resolvers/__init__.py +++ b/resolv/resolvers/__init__.py @@ -8,3 +8,4 @@ from pastebin import * from mediafire import * from vidxden import * from vidbux import * +from filenuke import * diff --git a/resolv/resolvers/filenuke.py b/resolv/resolvers/filenuke.py new file mode 100644 index 0000000..bc6096d --- /dev/null +++ b/resolv/resolvers/filenuke.py @@ -0,0 +1,93 @@ +import re, time, urllib2 +from resolv.shared import ResolverError, TechnicalError, Task, unpack_js + +# No such file or the file has been removed due to copyright infringement issues. + +class FilenukeTask(Task): + result_type = "video" + + name = "Filenuke" + author = "Sven Slootweg" + author_url = "http://cryto.net/~joepie91" + + def run(self): + matches = re.search("https?:\/\/(www\.)?filenuke\.com\/([a-zA-Z0-9]+)", self.url) + + if matches is None: + self.state = "invalid" + raise ResolverError("The provided URL is not a valid Filenuke URL.") + + video_id = matches.group(2) + + try: + contents = self.fetch_page(self.url) + except urllib2.URLError, e: + self.state = "failed" + raise TechnicalError("Could not retrieve the video page.") + + if 'Choose how to download' not in contents: + self.state = "invalid" + raise ResolverError("The provided URL does not exist.") + + matches = re.search('', contents) + + if matches is None: + self.state = "failed" + raise TechnicalError("Could not find filename.") + + filename = matches.group(1) + + matches = re.search('', contents) + + if matches is None: + self.state = "failed" + raise TechnicalError("Could not find referer.") + + referer = matches.group(1) + + try: + contents = self.post_page(self.url, { + 'op': "download1", + 'usr_login': "", + 'id': video_id, + 'filename': filename, + 'referer': referer, + 'method_free': "Free" + }) + except urllib2.URLError, e: + self.state = "failed" + raise TechnicalError("Could not continue to download") + + matches = re.search('