summaryrefslogtreecommitdiffstats
path: root/core/module/plugins/hoster/YoutubeCom.py
diff options
context:
space:
mode:
authorGravatar mkaay <mkaay@mkaay.de> 2010-08-25 16:48:55 +0200
committerGravatar mkaay <mkaay@mkaay.de> 2010-08-25 16:48:55 +0200
commit3c9f55270a83b0e88ec0dc516f9d9921e4d7b6ea (patch)
treec5b2b1bfeb7eb8df2b97be118f6cbcec4e29cb3b /core/module/plugins/hoster/YoutubeCom.py
parentul.to fetching, so.biz expire (diff)
downloadpyload-3c9f55270a83b0e88ec0dc516f9d9921e4d7b6ea.tar.xz
merged gui
Diffstat (limited to 'core/module/plugins/hoster/YoutubeCom.py')
-rw-r--r--core/module/plugins/hoster/YoutubeCom.py48
1 files changed, 48 insertions, 0 deletions
diff --git a/core/module/plugins/hoster/YoutubeCom.py b/core/module/plugins/hoster/YoutubeCom.py
new file mode 100644
index 000000000..79c359ad7
--- /dev/null
+++ b/core/module/plugins/hoster/YoutubeCom.py
@@ -0,0 +1,48 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+from module.plugins.Hoster import Hoster
+
+class YoutubeCom(Hoster):
+ __name__ = "YoutubeCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://(www\.)?(de\.)?\youtube\.com/watch\?v=.*"
+ __version__ = "0.2"
+ __config__ = [ ("quality", "str" , "Quality Setting", "hd") ]
+ __description__ = """Youtube.com Video Download Hoster"""
+ __author_name__ = ("spoob")
+ __author_mail__ = ("spoob@pyload.org")
+
+ def process(self, pyfile):
+ html = self.load(pyfile.url)
+
+ if re.search(r"(.*eine fehlerhafte Video-ID\.)", html) != None:
+ self.offline()
+
+ videoId = pyfile.url.split("v=")[1].split("&")[0]
+ videoHash = re.search(r'&t=(.+?)&', html).group(1)
+
+
+ file_name_pattern = '<meta name="title" content="(.+?)">'
+ is_hd_pattern = r"'IS_HD_AVAILABLE': (false|true)"
+ file_suffix = ".flv"
+ is_hd = re.search(is_hd_pattern, html).group(1)
+ hd_available = (is_hd == "true")
+
+ if self.getConf("quality") == "hd" or self.getConf("quality") == "hq":
+ file_suffix = ".mp4"
+
+ name = (re.search(file_name_pattern, html).group(1).replace("/", "") + file_suffix).decode("utf8")
+ pyfile.name = name #.replace("&amp;", "&").replace("ö", "oe").replace("ä", "ae").replace("ü", "ue")
+
+ if self.getConf("quality") == "sd":
+ quality = "&fmt=6"
+ elif self.getConf("quality") == "hd" and hd_available:
+ quality = "&fmt=22"
+ else:
+ quality = "&fmt=18"
+
+ file_url = 'http://youtube.com/get_video?video_id=' + videoId + '&t=' + videoHash + quality + "&asv=2"
+
+ self.download(file_url)