summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/YoutubeCom.py
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-08-09 12:01:32 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-08-09 12:01:32 +0200
commita740d2bd6748368df16c8060c4a1173cb9547604 (patch)
tree4a71bfc77b0fdc17d07a44a1cadf5e60dc60b73f /module/plugins/hoster/YoutubeCom.py
parentAdded tag v0.4.7 for changeset 04f6f6fcc398 (diff)
downloadpyload-a740d2bd6748368df16c8060c4a1173cb9547604.tar.xz
youtube fix
Diffstat (limited to 'module/plugins/hoster/YoutubeCom.py')
-rw-r--r--module/plugins/hoster/YoutubeCom.py23
1 files changed, 10 insertions, 13 deletions
diff --git a/module/plugins/hoster/YoutubeCom.py b/module/plugins/hoster/YoutubeCom.py
index 9acd5b358..f02124a8a 100644
--- a/module/plugins/hoster/YoutubeCom.py
+++ b/module/plugins/hoster/YoutubeCom.py
@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
import re
-import urllib
+from urllib import unquote
from module.utils import html_unescape
from module.plugins.Hoster import Hoster
@@ -11,7 +11,7 @@ class YoutubeCom(Hoster):
__name__ = "YoutubeCom"
__type__ = "hoster"
__pattern__ = r"http://(www\.)?(de\.)?\youtube\.com/watch\?v=.*"
- __version__ = "0.21"
+ __version__ = "0.22"
__config__ = [("quality", "sd;hd;fullhd", "Quality Setting", "hd"),
("fmt", "int", "FMT Number 0-45", 0),
(".mp4", "bool", "Allow .mp4", True),
@@ -61,19 +61,16 @@ class YoutubeCom(Hoster):
if self.getConfig("fmt"):
desired_fmt = self.getConf("fmt")
- fmt_pattern = 'fmt_url_map=(.+?)&'
- fmt_url_map = re.search(fmt_pattern, html).group(1)
- links = urllib.unquote(fmt_url_map).split(",")
+ flashvars = re.search(r"flashvars=\"([^\"]+)", html)
+ flashvars = unquote(flashvars.group(1))
+
+ fmts = re.findall(r"itag=(\d+),url=([^&]+)", flashvars)
+
fmt_dict = {}
- for link in links:
- fmt = link.split("|")[0]
- try:
- fmt = int(fmt)
- except Exception:
- continue
-
- fmt_dict[fmt] = link.split("|")[1]
+ for fmt, url in fmts:
+ fmt = int(fmt)
+ fmt_dict[fmt] = unquote(url)
self.logDebug("Found links: %s" % fmt_dict)