From: Antonio Ospite Date: Sun, 12 Feb 2012 15:47:58 +0000 (+0100) Subject: Fix rai.tv support X-Git-Tag: 0.4~2 X-Git-Url: https://git.ao2.it/GM_direct_download_links.git/commitdiff_plain/c2a9f12bdb946e7b5758f003345fca8f54cee4f3?hp=5175c992803297edf8c7acd5faaba0aa38c5be8b Fix rai.tv support The pages structure has changed a little and smooth streaming links are not behind the re-link infrastructure as well and so they need to be processed. Signed-off-by: Antonio Ospite --- diff --git a/direct_download_links.user.js b/direct_download_links.user.js index 9344012..bd8e32a 100644 --- a/direct_download_links.user.js +++ b/direct_download_links.user.js @@ -107,11 +107,11 @@ var supported_sites = [ return true; }; }, - urlContainerXPath: '//div[@id="Player"]', + urlContainerXPath: '//div[@id="silverlightControlHost" or @id="SilverlightPlayer"]', urlRegexp: /mediaUri=(http:\/\/[^,]*)/, onEvent: { evt: 'DOMNodeInserted', targetElement: 'object' }, processURL: _rai_get_actual_url, - linkDestXPath: '//div[@id="Player"]', + linkDestXPath: '//div[@id="silverlightControlHost" or @id="SilverlightPlayer"]', }, { locationRegexp: /^http:\/\/soundcloud.com\/.*$/, @@ -267,9 +267,21 @@ function _rai_get_actual_url(site, URL) { parser = new DOMParser(); xmlDoc = parser.parseFromString(text, "text/xml"); - ref = xmlDoc.getElementsByTagName('REF'); - if (ref.length > 0) { - href = ref[0].getAttribute('HREF');; + // MMS streams + elems = xmlDoc.getElementsByTagName('REF'); + if (elems.length > 0) { + href = elems[0].getAttribute('HREF');; + + var evt = document.createEvent('Event'); + evt.initEvent('UrlFetched', true, true); + evt.site = site; + evt.URL = href; + document.dispatchEvent(evt); + } + // SmoothStreaming streams + elems = xmlDoc.getElementsByTagName('playListItem'); + if (elems.length > 0) { + href = elems[0].getAttribute('mediaSource');; var evt = document.createEvent('Event'); evt.initEvent('UrlFetched', true, true);