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 $display_name = "Dailymotion",
41 $enable = function (buffer) {
42 media_setup_local_object_classes(buffer);
46 var dailymotion_re = build_url_regex($domain = /(?:[^\/]*\.)?dailymotion/);
47 auto_mode_list.push([dailymotion_re, dailymotion_mode]);
48 media_scrapers.unshift([dailymotion_re, media_scrape_dailymotion]);
50 provide("dailymotion");