diff --git a/resolv/__init__.py b/resolv/__init__.py index 8b58b0f..21ca5d6 100644 --- a/resolv/__init__.py +++ b/resolv/__init__.py @@ -19,6 +19,12 @@ def resolve(url): elif re.match("https?:\/\/(www\.)?filebox\.com\/[a-zA-Z0-9]+", url) is not None: task = resolvers.FileboxTask(url) return task.run() + elif re.match("https?:\/\/(www\.)?vidxden\.com\/[a-zA-Z0-9]+", url) is not None: + task = resolvers.VidxdenTask(url) + return task.run() + 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\.)?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 b514ffd..6c0e8b2 100644 --- a/resolv/resolvers/__init__.py +++ b/resolv/resolvers/__init__.py @@ -6,3 +6,5 @@ from youtube import * from filebox import * from pastebin import * from mediafire import * +from vidxden import * +from vidbux import * diff --git a/resolv/resolvers/vidbux.py b/resolv/resolvers/vidbux.py new file mode 100644 index 0000000..0777a69 --- /dev/null +++ b/resolv/resolvers/vidbux.py @@ -0,0 +1,85 @@ +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 VidbuxTask(Task): + result_type = "video" + + name = "VidBux" + author = "Sven Slootweg" + author_url = "http://cryto.net/~joepie91" + + def run(self): + matches = re.search("https?:\/\/(www\.)?vidbux\.com\/([a-zA-Z0-9]+)", self.url) + + if matches is None: + self.state = "invalid" + raise ResolverError("The provided URL is not a valid VidBux 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 'Human Verification' 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': "Continue to Video" + }) + except urllib2.URLError, e: + self.state = "failed" + raise TechnicalError("Could not complete human verification") + + script = unpack_js(contents) + + matches = re.search("'file','([^']+)'", script) + + if matches is None: + self.state = "failed" + raise TechnicalError("No video was found on the specified URL.") + + video_file = matches.group(1) + + stream_dict = { + 'url' : video_file, + 'method' : "GET", + 'quality' : "unknown", + 'priority' : 1, + 'format' : "unknown" + } + + self.results = { + 'title': "", + 'videos': [stream_dict] + } + + self.state = "finished" + return self diff --git a/resolv/resolvers/vidxden.py b/resolv/resolvers/vidxden.py new file mode 100644 index 0000000..683ee0c --- /dev/null +++ b/resolv/resolvers/vidxden.py @@ -0,0 +1,85 @@ +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 VidxdenTask(Task): + result_type = "video" + + name = "VidX Den" + author = "Sven Slootweg" + author_url = "http://cryto.net/~joepie91" + + def run(self): + matches = re.search("https?:\/\/(www\.)?vidxden\.com\/([a-zA-Z0-9]+)", self.url) + + if matches is None: + self.state = "invalid" + raise ResolverError("The provided URL is not a valid VidX Den 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 'Human Verification' 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': "Continue to Video" + }) + except urllib2.URLError, e: + self.state = "failed" + raise TechnicalError("Could not complete human verification") + + script = unpack_js(contents) + + matches = re.search("'file','([^']+)'", script) + + if matches is None: + self.state = "failed" + raise TechnicalError("No video was found on the specified URL.") + + video_file = matches.group(1) + + stream_dict = { + 'url' : video_file, + 'method' : "GET", + 'quality' : "unknown", + 'priority' : 1, + 'format' : "unknown" + } + + self.results = { + 'title': "", + 'videos': [stream_dict] + } + + self.state = "finished" + return self diff --git a/test.py b/test.py index 5d6b356..333b3d0 100644 --- a/test.py +++ b/test.py @@ -23,6 +23,12 @@ suites = { }, 'youtube': { "YouTube": "http://www.youtube.com/watch?v=XSGBVzeBUbk" + }, + 'vidxden': { + "VidX Den": "http://www.vidxden.com/l404fifyhfn1" + }, + 'vidbux': { + "VidBux": "http://www.vidbux.com/5ovunjri3fqq" } }