2 * (C) Copyright 2008 Jeremy Maitin-Shepard
4 * Use, modification, and distribution are subject to the terms specified in the
10 require("content-buffer.js");
13 function media_scrape_dailymotion(buffer, results) {
14 var text = unescape(buffer.document.documentElement.innerHTML);
15 const reg = /video=([^&]+)&/;
17 const reg2 = /([^\|]*)@@\w+$/;
18 var match = reg.exec(text);
20 if (!match || !(param = match[1]))
23 param = unescape(param);
25 match = reg2.exec(param);
27 if (!match || !(path = match[1]))
29 let title = get_meta_title(buffer.document);
31 title = title.replace("Dailymotion : ", "");
32 results.push(load_spec({uri: "http://dailymotion.com" + path,
34 filename_extension: "flv",
35 source_frame: buffer.top_frame,
36 mime_type: "video/x-flv"}));
39 define_page_mode("dailymotion-mode",
40 build_url_regexp($domain = /(?:[^\/]*\.)?dailymotion/),
41 function enable (buffer) {
42 media_setup_local_object_classes(buffer);
44 function disable (buffer) {},
45 $display_name = "Dailymotion");
47 page_mode_activate(dailymotion_mode);
49 media_scrapers.unshift([dailymotion_mode.test, media_scrape_dailymotion]);
51 provide("dailymotion");