grooveshark.js: update button selectors because website was updated
[conkeror.git] / modules / page-modes / dailymotion.js
blob6ca2a6ad7a0605f5e619bc3039141afefebb0d77
1 /**
2  * (C) Copyright 2008 Jeremy Maitin-Shepard
3  *
4  * Use, modification, and distribution are subject to the terms specified in the
5  * COPYING file.
6 **/
8 require("content-buffer.js");
9 require("media.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);
17     var param;
18     if (!match || !(param = match[1]))
19         return;
21     param = unescape(param);
23     match = reg2.exec(param);
24     var path;
25     if (!match || !(path = match[1]))
26         return;
27     let title = get_meta_title(buffer.document);
28     if (title)
29         title = title.replace("Dailymotion : ", "");
30     results.push(load_spec({uri: "http://dailymotion.com" + path,
31                             title: title,
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);
43     },
44     function disable (buffer) {
45         media_disable_local_object_classes(buffer);
46     },
47     $display_name = "Dailymotion");
49 page_mode_activate(dailymotion_mode);
51 media_scrapers.unshift([dailymotion_mode_test, media_scrape_dailymotion]);
53 provide("dailymotion");