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