X-Git-Url: https://git.ao2.it/GM_direct_download_links.git/blobdiff_plain/5175c992803297edf8c7acd5faaba0aa38c5be8b..c2a9f12bdb946e7b5758f003345fca8f54cee4f3:/direct_download_links.user.js?ds=sidebyside 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);