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 var dailymotion_mode_test = build_url_regexp($domain = /(?:[^\/]*\.)?dailymotion/);
39 define_page_mode("dailymotion-mode",
40 dailymotion_mode_test,
41 function enable (buffer) {
42 media_setup_local_object_classes(buffer);
44 function disable (buffer) {
45 media_disable_local_object_classes(buffer);
47 $display_name = "Dailymotion");
49 page_mode_activate(dailymotion_mode);
51 media_scrapers.unshift([dailymotion_mode_test, media_scrape_dailymotion]);
53 provide("dailymotion");