summaryrefslogtreecommitdiffstats
path: root/module/plugins
diff options
context:
space:
mode:
authorGravatar mkaay <mkaay@mkaay.de> 2010-02-08 15:58:48 +0100
committerGravatar mkaay <mkaay@mkaay.de> 2010-02-08 15:58:48 +0100
commita02a3ecd5b23b5380cf41e161f02a044d1db00af (patch)
treeb736bf80eb9d28a4a757c299b118c52720ce9478 /module/plugins
parentfixed click'n'load, added youtube hd option (diff)
downloadpyload-a02a3ecd5b23b5380cf41e161f02a044d1db00af.tar.xz
fixed youtube hd
Diffstat (limited to 'module/plugins')
-rw-r--r--module/plugins/hoster/YoutubeCom.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/module/plugins/hoster/YoutubeCom.py b/module/plugins/hoster/YoutubeCom.py
index 19fc1099d..a7c5a645d 100644
--- a/module/plugins/hoster/YoutubeCom.py
+++ b/module/plugins/hoster/YoutubeCom.py
@@ -20,6 +20,7 @@ class YoutubeCom(Plugin):
self.parent = parent
self.html = None
self.read_config()
+ self.hd_available = False
def download_html(self):
url = self.parent.url
@@ -36,10 +37,10 @@ class YoutubeCom(Plugin):
quality = ""
if self.config['quality'] == "sd":
quality = "&fmt=6"
- elif self.config['quality'] == "hq":
- quality = "&fmt=18"
- elif self.config['quality'] == "hd":
+ elif self.config['quality'] == "hd" and self.hd_available:
quality = "&fmt=22"
+ else:
+ quality = "&fmt=18"
file_url = 'http://youtube.com/get_video?video_id=' + videoId + '&t=' + videoHash + quality
return file_url
@@ -57,7 +58,10 @@ class YoutubeCom(Plugin):
self.download_html()
file_name_pattern = r"'VIDEO_TITLE': '(.*)',"
+ is_hd_pattern = r"'IS_HD_AVAILABLE': (false|true)"
file_suffix = ".flv"
+ is_hd = re.search(is_hd_pattern, self.html).group(1)
+ self.hd_available = (is_hd == "true")
if self.config['quality'] == "hd" or self.config['quality'] == "hq":
file_suffix = ".mp4"
name = re.search(file_name_pattern, self.html).group(1).replace("/", "") + file_suffix