From c445991679b40bcb6f956bb30903b823a90a5c7f Mon Sep 17 00:00:00 2001 From: anovicecodemonkey Date: Mon, 17 Mar 2014 02:02:54 +1030 Subject: [PATCH] More generic support for Ooyala Player This commit adds more generic support for Ooyala Player. It should remove the need for slashdot.py and vice.py (but I will leave that decision up to others), as well as add support for sites that don't follow the usual pattern by searching for "var embedCode" which as best as I can tell is a variable unique to Ooyala Player and shouldn't cause any false positives or conflicts with other extractors. --- youtube_dl/extractor/generic.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/youtube_dl/extractor/generic.py b/youtube_dl/extractor/generic.py index 66e189da1..afb08f76a 100644 --- a/youtube_dl/extractor/generic.py +++ b/youtube_dl/extractor/generic.py @@ -392,10 +392,18 @@ class GenericIE(InfoExtractor): return self.url_result(mobj.group('url')) # Look for Ooyala videos + + # First, try and see if the full player URL is provided mobj = re.search(r'player.ooyala.com/[^"?]+\?[^"]*?(?:embedCode|ec)=([^"&]+)', webpage) if mobj is not None: return OoyalaIE._build_url_result(mobj.group(1)) - + + # If it isn't, you have to dig deeper. "OO.Player.create" can be given different values. + # Best bet is to simply look for the embed code variable inside the Javascript. + mobj = re.search(r"var embedCode = '(.*?)';", webpage) + if mobj is not None: + return OoyalaIE._build_url_result(mobj.group(1)) + # Look for Aparat videos mobj = re.search(r'