[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[linterna-magica-commit] [160] Support for livestream dot com.
From: |
Ivaylo Valkov |
Subject: |
[linterna-magica-commit] [160] Support for livestream dot com. |
Date: |
Tue, 26 Jul 2011 11:11:08 +0000 |
Revision: 160
http://svn.sv.gnu.org/viewvc/?view=rev&root=linterna-magica&revision=160
Author: valkov
Date: 2011-07-26 11:11:06 +0000 (Tue, 26 Jul 2011)
Log Message:
-----------
Support for livestream dot com. Work on tasks #11211.
Ticket Links:
------------
http://savannah.gnu.org/task/?11211
Modified Paths:
--------------
trunk/src/lm_extract_dom_objects.js
trunk/src/lm_extract_video_link.js
Added Paths:
-----------
trunk/src/lm_site_livestreamcom.js
Modified: trunk/src/lm_extract_dom_objects.js
===================================================================
--- trunk/src/lm_extract_dom_objects.js 2011-07-26 08:18:01 UTC (rev 159)
+++ trunk/src/lm_extract_dom_objects.js 2011-07-26 11:11:06 UTC (rev 160)
@@ -248,6 +248,25 @@
{
this.request_bliptv_jsonp_data(object_data);
}
+ else if ((
+ !/livestream\.com/i.test(window.location.hostname) &&
+ ((object.hasAttribute('src') &&
+ /livestream\.com/i.test(
+ object.getAttribute('src'))) ||
+ (object.hasAttribute('data') &&
+ /livestream\.com/i.test(
+ object.getAttribute('data'))))) ||
+ (/livestream\.com/i.test(
+ window.location.hostname) &&
+ ((object.hasAttribute('src') &&
+ /livestream\.com/i.test(
+ object.getAttribute('src'))) ||
+ (object.hasAttribute('data') &&
+ /livestream\.com/i.test(
+ object.getAttribute('data'))))))
+ {
+ this.request_livestreamcom_jsonp_data(object_data);
+ }
else if (this.wait_xhr)
{
this.log("LinternaMagica.extract_objects_from_dom:\n"+
Modified: trunk/src/lm_extract_video_link.js
===================================================================
--- trunk/src/lm_extract_video_link.js 2011-07-26 08:18:01 UTC (rev 159)
+++ trunk/src/lm_extract_video_link.js 2011-07-26 11:11:06 UTC (rev 160)
@@ -183,7 +183,7 @@
{
video_id_re = new RegExp (
"(\\\"|\\\'|\\\&|\\\?|\\\;|\\\/|\\\.|\\\=)(itemid|"+
- "clip_id|video_id|vid|player_config\\\.php\\\?v|"+
+ "clip_id|clip|video_id|vid|player_config\\\.php\\\?v|"+
"videoid|media_id|vkey|video3|_videoid|"+
"vimeo_clip_|php&ID|\\\/video_embed\\\/\\\?id)"+
"(\\\"|\\\')*(\\\=|\\\:|,|\\\/)\\\s*(\\\"|\\\')*"+
Added: trunk/src/lm_site_livestreamcom.js
===================================================================
--- trunk/src/lm_site_livestreamcom.js (rev 0)
+++ trunk/src/lm_site_livestreamcom.js 2011-07-26 11:11:06 UTC (rev 160)
@@ -0,0 +1,116 @@
+// @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) 2011 Ivaylo Valkov <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["livestream.com"] = new Object();
+
+// Reference
+LinternaMagica.prototype.sites["www.livestream.com"] = "livestream.com";
+
+// Makes a JSONP request that fetches the clip data in Livestream.com
+LinternaMagica.prototype.request_livestreamcom_jsonp_data =
+function (object_data)
+{
+ var flash_object =
+ this.get_flash_video_object(object_data.linterna_magica_id);
+
+ if (!flash_object)
+ {
+ return null;
+ }
+
+ var attrib = null;
+ var channel_re = null;
+
+ if (flash_object.localName.toLowerCase() == "embed" ||
+ flash_object.localName.toLowerCase() == "iframe")
+ {
+ attrib = "src";
+ }
+ else if (flash_object.localName.toLowerCase() == "object")
+ {
+ attrib = "data";
+ }
+
+ if (flash_object.localName.toLowerCase() == "object" ||
+ flash_object.localName.toLowerCase() == "embed")
+ {
+ channel_re = new RegExp (
+ "channel=(.*)&",
+ "i");
+ }
+ else if (flash_object.localName.toLowerCase() == "iframe")
+ {
+ channel_re = new RegExp ("\\\/embed\\\/(.*)\\\?");
+ }
+
+ var data = flash_object.getAttribute(attrib);
+
+ if (!data)
+ {
+ return null;
+ }
+
+ var channel = data.match(channel_re);
+
+ if (!channel || (channel && !channel[channel.length-1]))
+ {
+ return null;
+ }
+
+ channel = channel[channel.length-1];
+
+ var jsonp_request_data = new Object();
+
+ jsonp_request_data.frame_id = "livestreamcom_jsonp_data_fetcher";
+ jsonp_request_data.parser_timeout = this.livestreamcom_jsonp_timeout;
+ jsonp_request_data.parser_timeout_counter =
+ this.livestream_jsonp_timeout_counter;
+ jsonp_request_data.jsonp_script_link = "http://x"+channel+
+ "x.api.channel.livestream.com/3.0/getstream.json?id="+
+ object_data.video_id+"&callback=livestreamcom_video_data";
+
+ "http://blip.tv/players/episode/"+object_data.video_id+
+ "?skin=json&callback=bliptv_video_data&version=2";
+ jsonp_request_data.jsonp_function = "livestreamcom_video_data";
+ jsonp_request_data.parser_function =
+ this.parse_livestreamcom_jsonp_data;
+ jsonp_request_data.user_data = object_data;
+
+ this.log("LinternaMagica.request_bliptv_jsonp_data:\n"+
+ "Requesting (JSONP) Livestream.com video link via video_id "+
+ object_data.video_id,1);
+
+ this.create_checker_frame(jsonp_request_data);
+}
+
+LinternaMagica.prototype.parse_livestreamcom_jsonp_data =
+function(data,object_data)
+{
+ object_data.link = data.progressiveUrl;
+ this.create_video_object(object_data);
+}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [linterna-magica-commit] [160] Support for livestream dot com.,
Ivaylo Valkov <=