[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[linterna-magica-commit] [152] Changes for tasks #11216.
From: |
Ivaylo Valkov |
Subject: |
[linterna-magica-commit] [152] Changes for tasks #11216. |
Date: |
Mon, 25 Jul 2011 09:13:04 +0000 |
Revision: 152
http://svn.sv.gnu.org/viewvc/?view=rev&root=linterna-magica&revision=152
Author: valkov
Date: 2011-07-25 09:13:04 +0000 (Mon, 25 Jul 2011)
Log Message:
-----------
Changes for tasks #11216. Added rule to prepare the data for XHR. All sites
migrated to the new code. Dropped support for sites that do not exist anymore.
Ticket Links:
------------
http://savannah.gnu.org/task/?11216
Modified Paths:
--------------
branches/task-11216/WEBSITES
branches/task-11216/src/lm_site_bliptv.js
branches/task-11216/src/lm_site_dailymotion.js
branches/task-11216/src/lm_site_myvideode.js
branches/task-11216/src/lm_site_theonion.js
branches/task-11216/src/lm_site_vimeo.js
branches/task-11216/src/lm_site_youtube.js
branches/task-11216/src/lm_sites.js
branches/task-11216/src/lm_xhr.js
Added Paths:
-----------
branches/task-11216/src/lm_site_boozhocom.js
branches/task-11216/src/lm_site_vbox7com.js
branches/task-11216/src/lm_site_videoclipsdumpcom.js
Modified: branches/task-11216/WEBSITES
===================================================================
--- branches/task-11216/WEBSITES 2011-07-21 13:24:41 UTC (rev 151)
+++ branches/task-11216/WEBSITES 2011-07-25 09:13:04 UTC (rev 152)
@@ -25,10 +25,6 @@
- It seems metacafe changes some things often. You might
experience some trouble.
http://www.4videosharing.com
- - Seems their account is disabled by their hosting provider.
-http://www.vidoemo.com
- - Seems it is disabled and redirects to random sites with sex
- content.
http://www.videoclipsdump.com
- Support re-written in 0.0.9. Everything seems to be working.
http://www.boomclips.com
@@ -87,9 +83,6 @@
http://jwak.net
http://failo.bg
- Hosting account suspended
-http://www.mediashare.bg
- - Does not exist anymore.
- - Only clips hosted at the site worked.
http://www.arenamedia.net
http://www.screen.bg
http://www.crazy.bg
Modified: branches/task-11216/src/lm_site_bliptv.js
===================================================================
--- branches/task-11216/src/lm_site_bliptv.js 2011-07-21 13:24:41 UTC (rev
151)
+++ branches/task-11216/src/lm_site_bliptv.js 2011-07-25 09:13:04 UTC (rev
152)
@@ -125,3 +125,14 @@
return null;
}
+LinternaMagica.prototype.sites["blip.tv"].prepare_xhr =
+function(object_data)
+{
+ // Will be called if (when) blip.tv changes the code they use to
+ // embed clips in blip.tv. Now the JSONP method is used.
+ var result= new Object();
+
+ result.address = "/rss/flash/"+object_data.video_id;
+
+ return result;
+}
Added: branches/task-11216/src/lm_site_boozhocom.js
===================================================================
--- branches/task-11216/src/lm_site_boozhocom.js
(rev 0)
+++ branches/task-11216/src/lm_site_boozhocom.js 2011-07-25 09:13:04 UTC
(rev 152)
@@ -0,0 +1,42 @@
+// @licstart The following is the entire license notice for the
+// JavaScript code in this page (or file).
+//
+// This file is part of Linterna Mágica
+//
+// Copyright (C) 2010, 2011 Ivaylo Valkov <address@hidden>
+// Copyright (C) 2010 Anton Katsarov <address@hidden>
+//
+// The JavaScript code in this page (or file) is free software: you
+// can redistribute it and/or modify it under the terms of the GNU
+// General Public License (GNU GPL) as published by the Free Software
+// Foundation, either version 3 of the License, or (at your option)
+// any later version. The code is distributed WITHOUT ANY WARRANTY
+// without even the implied warranty of MERCHANTABILITY or FITNESS
+// FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
+//
+// As additional permission under GNU GPL version 3 section 7, you
+// may distribute non-source (e.g., minimized or compacted) forms of
+// that code without the copy of the GNU GPL normally required by
+// section 4, provided you include this license notice and a URL
+// through which recipients can access the Corresponding Source.
+//
+// @licend The above is the entire license notice for the JavaScript
+// code in this page (or file).
+//
+// @source http://linterna-magica.nongnu.org
+
+// END OF LICENSE HEADER
+
+LinternaMagica.prototype.sites["boozho.com"] = new Object();
+
+// Reference
+LinternaMagica.prototype.sites["www.boozho.com"] = "boozho.com";
+
+LinternaMagica.prototype.sites["boozho.com"].prepare_xhr =
+function(object_data)
+{
+ var result = new Object();
+ result.address = "/player_playlist.php?v="+object_data.video_id;
+
+ return result;
+}
Modified: branches/task-11216/src/lm_site_dailymotion.js
===================================================================
--- branches/task-11216/src/lm_site_dailymotion.js 2011-07-21 13:24:41 UTC
(rev 151)
+++ branches/task-11216/src/lm_site_dailymotion.js 2011-07-25 09:13:04 UTC
(rev 152)
@@ -121,3 +121,19 @@
return window.location.pathname;
}
+
+LinternaMagica.prototype.sites["dailymotion.com"].prepare_xhr =
+function(object_data)
+{
+ var result = new Object();
+
+ // The video_id is forced to an address. See
+ // LinternaMagica.prototype.sites["dailymotion.com"].
+ // libswfobject_skip_video_id_extraction
+ result.address = object_data.video_id;
+
+ this.extract_cookies();
+ this.expire_cookies();
+
+ return result;
+}
Modified: branches/task-11216/src/lm_site_myvideode.js
===================================================================
--- branches/task-11216/src/lm_site_myvideode.js 2011-07-21 13:24:41 UTC
(rev 151)
+++ branches/task-11216/src/lm_site_myvideode.js 2011-07-25 09:13:04 UTC
(rev 152)
@@ -92,3 +92,13 @@
return object_data ;
}
+
+LinternaMagica.prototype.sites["myvideo.de"].prepare_xhr =
+function(object_data)
+{
+ var result = new Object();
+
+ result.address = "/watch/"+object_data.video_id+"/";
+
+ return result;
+}
Modified: branches/task-11216/src/lm_site_theonion.js
===================================================================
--- branches/task-11216/src/lm_site_theonion.js 2011-07-21 13:24:41 UTC (rev
151)
+++ branches/task-11216/src/lm_site_theonion.js 2011-07-25 09:13:04 UTC (rev
152)
@@ -156,3 +156,12 @@
return this.sites.__no_flash_plugin_installed.apply(this, [arguments]);
}
+LinternaMagica.prototype.sites["theonion.com"].prepare_xhr =
+function(object_data)
+{
+ var result = new Object();
+
+ result.address = "/ajax/onn/embed/"+object_data.video_id+".json";
+
+ return result;
+}
Added: branches/task-11216/src/lm_site_vbox7com.js
===================================================================
--- branches/task-11216/src/lm_site_vbox7com.js (rev 0)
+++ branches/task-11216/src/lm_site_vbox7com.js 2011-07-25 09:13:04 UTC (rev
152)
@@ -0,0 +1,46 @@
+// @licstart The following is the entire license notice for the
+// JavaScript code in this page (or file).
+//
+// This file is part of Linterna Mágica
+//
+// Copyright (C) 2010, 2011 Ivaylo Valkov <address@hidden>
+// Copyright (C) 2010 Anton Katsarov <address@hidden>
+//
+// The JavaScript code in this page (or file) is free software: you
+// can redistribute it and/or modify it under the terms of the GNU
+// General Public License (GNU GPL) as published by the Free Software
+// Foundation, either version 3 of the License, or (at your option)
+// any later version. The code is distributed WITHOUT ANY WARRANTY
+// without even the implied warranty of MERCHANTABILITY or FITNESS
+// FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
+//
+// As additional permission under GNU GPL version 3 section 7, you
+// may distribute non-source (e.g., minimized or compacted) forms of
+// that code without the copy of the GNU GPL normally required by
+// section 4, provided you include this license notice and a URL
+// through which recipients can access the Corresponding Source.
+//
+// @licend The above is the entire license notice for the JavaScript
+// code in this page (or file).
+//
+// @source http://linterna-magica.nongnu.org
+
+// END OF LICENSE HEADER
+
+LinternaMagica.prototype.sites["vbox7.com"] = new Object();
+
+// Reference
+LinternaMagica.prototype.sites["www.vbox7.com"] = "vbox7.com";
+
+LinternaMagica.prototype.sites["vbox7.com"].prepare_xhr =
+function(object_data)
+{
+ var result = new Object();
+
+ result.address ="/play/magare.do";
+ result.method = "POST";
+ result.data = "vid="+object_data.video_id;
+ result.content= "application/x-www-form-urlencoded";
+
+ return result;
+}
Added: branches/task-11216/src/lm_site_videoclipsdumpcom.js
===================================================================
--- branches/task-11216/src/lm_site_videoclipsdumpcom.js
(rev 0)
+++ branches/task-11216/src/lm_site_videoclipsdumpcom.js 2011-07-25
09:13:04 UTC (rev 152)
@@ -0,0 +1,44 @@
+// @licstart The following is the entire license notice for the
+// JavaScript code in this page (or file).
+//
+// This file is part of Linterna Mágica
+//
+// Copyright (C) 2010, 2011 Ivaylo Valkov <address@hidden>
+// Copyright (C) 2010 Anton Katsarov <address@hidden>
+//
+// The JavaScript code in this page (or file) is free software: you
+// can redistribute it and/or modify it under the terms of the GNU
+// General Public License (GNU GPL) as published by the Free Software
+// Foundation, either version 3 of the License, or (at your option)
+// any later version. The code is distributed WITHOUT ANY WARRANTY
+// without even the implied warranty of MERCHANTABILITY or FITNESS
+// FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
+//
+// As additional permission under GNU GPL version 3 section 7, you
+// may distribute non-source (e.g., minimized or compacted) forms of
+// that code without the copy of the GNU GPL normally required by
+// section 4, provided you include this license notice and a URL
+// through which recipients can access the Corresponding Source.
+//
+// @licend The above is the entire license notice for the JavaScript
+// code in this page (or file).
+//
+// @source http://linterna-magica.nongnu.org
+
+// END OF LICENSE HEADER
+
+LinternaMagica.prototype.sites["videoclipsdump.com"] = new Object();
+
+// Reference
+LinternaMagica.prototype.sites["www.videoclipsdump.com"] =
"videoclipsdump.com";
+
+LinternaMagica.prototype.sites["videoclipsdump.com"].prepare_xhr =
+function(object_data)
+{
+ var result = new Object();
+
+ result.address = "/player/cbplayer/settings.php?vid="+
+ object_data.video_id;
+
+ return result;
+}
Modified: branches/task-11216/src/lm_site_vimeo.js
===================================================================
--- branches/task-11216/src/lm_site_vimeo.js 2011-07-21 13:24:41 UTC (rev
151)
+++ branches/task-11216/src/lm_site_vimeo.js 2011-07-25 09:13:04 UTC (rev
152)
@@ -146,3 +146,18 @@
return null;
}
+
+LinternaMagica.prototype.sites["vimeo.com"].prepare_xhr =
+function(object_data)
+{
+ var result = new Object();
+
+ result.address = "/moogaloop/load/clip:"+object_data.video_id;
+
+ // Remove cookies and fetch page again. See "A note on
+ // cookies".
+ // this.extract_cookies();
+ // this.expire_cookies();
+
+ return result;
+}
Modified: branches/task-11216/src/lm_site_youtube.js
===================================================================
--- branches/task-11216/src/lm_site_youtube.js 2011-07-21 13:24:41 UTC (rev
151)
+++ branches/task-11216/src/lm_site_youtube.js 2011-07-25 09:13:04 UTC (rev
152)
@@ -350,3 +350,32 @@
return false;
}
+LinternaMagica.prototype.sites["youtube.com"].prepare_xhr =
+function(object_data)
+{
+ var result = new Object();
+
+ var location_href = window.location.href;
+
+ var uri_args = null;
+ // Some clips require &skipcontrinter=1. Other might require
+ // something else.
+ if (/&/i.test(location_href))
+ {
+ uri_args = location_href.split(/&/);
+ // This is the host and path (http://...). We do not need
+ // it.
+ delete uri_args[0];
+ uri_args = uri_args.join("&");
+ }
+
+ result.address = "/watch?v="+object_data.video_id+
+ (uri_args ? ("&"+uri_args) : "");
+
+ // Remove cookies and fetch page again. See "A note on
+ // cookies".
+ this.extract_cookies();
+ this.expire_cookies();
+
+ return result;
+}
Modified: branches/task-11216/src/lm_sites.js
===================================================================
--- branches/task-11216/src/lm_sites.js 2011-07-21 13:24:41 UTC (rev 151)
+++ branches/task-11216/src/lm_sites.js 2011-07-25 09:13:04 UTC (rev 152)
@@ -219,6 +219,25 @@
return true;
}
+// Returns the data needed to fetch a resource that has the video url.
+// Returned object
+// {
+// // The URL can be relative to the window.location.host. (required)
+// address: string,
+// // The method to be used for the request. (optional)
+// methog: string,
+// // The data to be send with the with the xhr.send() request :
+// // xrh.send(data) (optional)
+// data: string,
+// // The Content-Type header to be used for the request. (optional)
+// content: string,
+// }
+LinternaMagica.prototype.sites.__prepare_xhr = function(object_data)
+{
+ return false;
+}
+
+
// LinternaMagica.prototype.sites.__extract_scripts_extract_when // Condition
? DM /ted?
// LinternaMagica.prototype.sites.__wait_before_inserting_object_from-script
// FB
// LinternaMagica.prototype.sites.__extract_swfobject_regex
Modified: branches/task-11216/src/lm_xhr.js
===================================================================
--- branches/task-11216/src/lm_xhr.js 2011-07-21 13:24:41 UTC (rev 151)
+++ branches/task-11216/src/lm_xhr.js 2011-07-25 09:13:04 UTC (rev 152)
@@ -69,110 +69,19 @@
return null;
}
- if (/vbox7\.com/i.test(host))
- {
- address ="/play/magare.do";
- method = "POST";
- data = "vid="+video_id;
- content= "application/x-www-form-urlencoded";
- }
+ var self = this;
+ var val = this.call_site_function_at_position.apply(self,[
+ "prepare_xhr",
+ host, object_data]);
- if (/vimeo\.com/i.test(host))
+ if (val && typeof(val) != "boolean")
{
- address = "/moogaloop/load/clip:"+video_id;
-
- // Remove cookies and fetch page again. See "A note on
- // cookies".
- // this.extract_cookies();
- // this.expire_cookies();
+ address = val.address ? val.address : address ;
+ method = val.method ? val.method : method;
+ data = val.data ? val.data : data;
+ content = val.content ? val.content : content;
}
- if (/4videosharing\.com/i.test(host))
- {
- address = "/player/vConfig.php?vkey="+video_id;
- }
-
- // We should not be entering here anyway. It seems most objects
- // have the mediaURL variable)
- // if (/metacafe\.com/i.test(host))
- // {
- // address = "/fplayer.php?itemID="+video_id+"&t=embedded";
- // }
-
- if (/vbox\.bg/i.test(host))
- {
- address = "/extras/player/play.php?id="+video_id;
- }
-
- if (/boozho\.com/i.test(host))
- {
- address = "/player_playlist.php?v="+video_id;
- }
-
- // We have two options:
- // 1) Use address http://embed.vidoemo.com/player/vidoemo4.php?id=
- // and extract the flv link, then change &f= parameter fo HD links
- // 2) Use address http://www.vidoemo.com/videodownload.php?e=
- // and extract all links and use the FLV (if match as main link)
- // Links differ in key and path (v3.php -dw /v7.php -play)
- if (/vidoemo\.com/i.test(host))
- {
- // Using option 2
- address = "/videodownload.php?e="+video_id;
- }
-
- if (/youtube\.com/i.test(host) ||
- /youtube-nocookie\.com/i.test(host))
- {
- var uri_args = null;
- // Some clips require &skipcontrinter=1. Other might require
- // something else.
- if (/&/i.test(location_href))
- {
- uri_args = location_href.split(/&/);
- // This is the host and path (http://...). We do not need
- // it.
- delete uri_args[0];
- uri_args = uri_args.join("&");
- }
-
- address = "/watch?v="+video_id +(uri_args ? ("&"+uri_args) : "");
-
- // Remove cookies and fetch page again. See "A note on
- // cookies".
- this.extract_cookies();
- this.expire_cookies();
- }
-
- if (/myvideo\.de/i.test(host))
- {
- address = "/watch/"+video_id+"/";
- }
-
- if (/dailymotion\.com/i.test(host))
- {
- this.extract_cookies();
- this.expire_cookies();
- // Forced this way! See lm_extract_dom_objects.js
- // LinternaMagica.extract_objects_from_dom();
- address = object_data.video_id;
- }
-
- if (/videoclipsdump\.com/i.test(host))
- {
- address = "/player/cbplayer/settings.php?vid="+video_id;
- }
-
- if (/theonion\.com/i.test(host))
- {
- address = "/ajax/onn/embed/"+video_id+".json";
- }
-
- if (/blip\.tv/i.test(host))
- {
- address="/rss/flash/"+video_id;
- }
-
var self = this;
client.onreadystatechange = function() {
var client = this;
@@ -186,7 +95,11 @@
return null;
}
- address = protocol+"//"+host+address;
+ // Only set the address if it is relative
+ if (!/^http/i.test(address))
+ {
+ address = protocol+"//"+host+address;
+ }
client.open(method,address ,true);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [linterna-magica-commit] [152] Changes for tasks #11216.,
Ivaylo Valkov <=