summaryrefslogtreecommitdiffstats
path: root/Plugins/BluehostTo.py
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2009-06-05 13:49:17 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2009-06-05 13:49:17 +0200
commite028f8f826416679dac171b8a37c6b6264ac1b2e (patch)
treee4bb8ae83d4491f033694ce2159fe7d88e6f5bb8 /Plugins/BluehostTo.py
parentmerged (diff)
downloadpyload-e028f8f826416679dac171b8a37c6b6264ac1b2e.tar.xz
request cookies support, Shragle Plugin, Youtube Channel Plugin, Bluehost Plugin (correct regexp needed)
Diffstat (limited to 'Plugins/BluehostTo.py')
-rw-r--r--Plugins/BluehostTo.py71
1 files changed, 71 insertions, 0 deletions
diff --git a/Plugins/BluehostTo.py b/Plugins/BluehostTo.py
new file mode 100644
index 000000000..80ed1e61b
--- /dev/null
+++ b/Plugins/BluehostTo.py
@@ -0,0 +1,71 @@
+#!/usr/bin/env python
+import re
+import time
+
+from Plugin import Plugin
+
+class BluehostTo(Plugin):
+
+ def __init__(self, parent):
+ Plugin.__init__(self, parent)
+ props = {}
+ props['name'] = "BluehostTo"
+ props['type'] = "hoster"
+ props['pattern'] = r"http://(?:www.)?bluehost.to/file/"
+ props['version'] = "0.1"
+ props['description'] = """Bluehost Download PLugin"""
+ props['author_name'] = ("RaNaN")
+ props['author_mail'] = ("RaNaN@pyload.org")
+ self.props = props
+ self.parent = parent
+ self.html = None
+ self.multi_dl = False
+
+ def download_html(self):
+ url = self.parent.url
+ self.html = self.req.load(url)
+ time.sleep(1.5)
+ self.html = self.req.load(url, cookies=True)
+ print self.html
+
+ def get_file_url(self):
+ """ returns the absolute downloadable filepath
+ """
+ if self.html == None:
+ self.download_html()
+
+ #@todo: regexp not correct, value switches its position
+
+
+ self.BluehostVers2dl = re.search(r"(name=\"BluehostVers2dl\")?.{1,10}value=\"([^\"]+).{1,10}(name=\"BluehostVers2dl\")?", self.html).group(2)
+ print self.BluehostVers2dl
+ self.DownloadV2Hash = re.search(r"value=\"([^\"]+) name=\"DownloadV2Hash\"", self.html).group(1)
+ print self.DownloadV2Hash
+ self.PHPSESSID = re.search(r"value=\"([^\"]+) name=\"PHPSESSID\"", self.html).group(1)
+ print self.PHPSESSID
+ self.access = re.search(r"value=\"([^\"]+) name=\"access\"", self.html).group(1)
+ print self.access
+
+ url = re.search("<form target=\"_self\" action=\"([^\"]+", self.html).group(1)
+ return url
+
+ def get_file_name(self):
+ if self.html == None:
+ self.download_html()
+ file_name_pattern = r"<center><b>.+: (.+)<\/b><\/center>"
+ return re.search(file_name_pattern, self.html).group(1)
+
+ def file_exists(self):
+ """ returns True or False
+ """
+ if self.html == None:
+ self.download_html()
+
+ if re.search(r"html", self.html) == None:
+ return False
+ else:
+ return True
+
+ def proceed(self, url, location):
+ return False
+ self.req.download(url, location, {'BluehostVers2dl': self.BluehostVers2dl, 'DownloadV2Hash': self.DownloadV2Hash, 'PHPSESSID': self.PHPSESSID, 'access': self.access}) \ No newline at end of file