Add support for slideshare.net
[GM_direct_download_links.git] / direct_download_links.user.js
index 11932f8..f9d51e1 100644 (file)
 // @name           Direct Download Links
 // @namespace      http://git.ao2.it/GM_direct_download_links.git
 // @description    Add direct download links
 // @name           Direct Download Links
 // @namespace      http://git.ao2.it/GM_direct_download_links.git
 // @description    Add direct download links
+// @grant          GM_log
+// @grant          GM_xmlhttpRequest
 // @include        http://video.repubblica.it/*
 // @include        http://tv.repubblica.it/*
 // @include        http://trovacinema.repubblica.it/*
 // @include        http://www.kataweb.it/tvzap/*
 // @include        http://www.rai.tv/*
 // @include        http://soundcloud.com/*
 // @include        http://video.repubblica.it/*
 // @include        http://tv.repubblica.it/*
 // @include        http://trovacinema.repubblica.it/*
 // @include        http://www.kataweb.it/tvzap/*
 // @include        http://www.rai.tv/*
 // @include        http://soundcloud.com/*
+// @include        http://www.telecinco.es/*
+// @include        http://slideshare.net/*
+// @include        http://www.slideshare.net/*
 // ==/UserScript==
 //
 
 // ==/UserScript==
 //
 
@@ -96,9 +101,9 @@ var supported_sites = [
   },
   {
     locationRegexp: /^http:\/\/www\.kataweb\.it\/tvzap\/.*$/,
   },
   {
     locationRegexp: /^http:\/\/www\.kataweb\.it\/tvzap\/.*$/,
-    urlContainerXPath: '//div[@id="tvzap_video"]',
-    urlRegexp: /'pcUrl', '((http|mms):\/\/[^']*)'/,
-    linkDestXPath: '//div[@id="tvzap_video"]',
+    urlContainerXPath: '//div[@id="contAB"]',
+    urlRegexp: /[^\/]addParam\('pcUrl', '((http|mms):\/\/[^']*)'/,
+    linkDestXPath: '//div[@id="contAB"]',
   },
   {
     locationRegexp: /^http:\/\/www\.rai\.tv\/.*$/,
   },
   {
     locationRegexp: /^http:\/\/www\.rai\.tv\/.*$/,
@@ -108,7 +113,7 @@ var supported_sites = [
       };
     },
     urlContainerXPath: '//div[@id="silverlightControlHost" or @id="SilverlightPlayer"]',
       };
     },
     urlContainerXPath: '//div[@id="silverlightControlHost" or @id="SilverlightPlayer"]',
-    urlRegexp: /mediaUri=(http:\/\/[^,]*)/,
+    urlRegexp: /mediaUri=(http:\/\/[^,"]*)/,
     onEvent: { evt: 'DOMNodeInserted', targetElement: 'object' },
     processURL: _rai_get_actual_url,
     linkDestXPath: '//div[@id="silverlightControlHost" or @id="SilverlightPlayer"]',
     onEvent: { evt: 'DOMNodeInserted', targetElement: 'object' },
     processURL: _rai_get_actual_url,
     linkDestXPath: '//div[@id="silverlightControlHost" or @id="SilverlightPlayer"]',
@@ -119,6 +124,27 @@ var supported_sites = [
     urlRegexp: /"streamUrl":"([^"]*)"/,
     linkDestXPath: '//div[@id="main-content-inner"]',
   },
     urlRegexp: /"streamUrl":"([^"]*)"/,
     linkDestXPath: '//div[@id="main-content-inner"]',
   },
+  {
+    locationRegexp: /^http:\/\/www\.telecinco.es\/.*$/,
+    urlContainerXPath: '//video[@class="video-js"]',
+    urlRegexp: /src="([^"]*)"/,
+    linkDestXPath: '//div[@class="pg-bd"]',
+  },
+  {
+    locationRegexp: /^http:\/\/(www\.|)slideshare.net\/.*$/,
+    urlContainerXPath: '//script[@id="page-json"]',
+    urlRegexp: /"ppt_location":"([^"]*)"/,
+    processURL: function(site, object_id) {
+      var URL = 'http://s3.amazonaws.com/slideshare/' + object_id + '.xml';
+      var evt = document.createEvent('Event');
+      evt.initEvent('UrlFetched', true, true);
+      evt.site = site;
+      evt.URL = URL;
+      document.dispatchEvent(evt);
+      return;
+    },
+    linkDestXPath: '//div[@class="playerWrapper"]',
+  },
 ];
 
 /* Apply different rules to different sites */
 ];
 
 /* Apply different rules to different sites */