Re: youtube.com in ELinks?

Witold Filipczyk <[email protected]>
Newsgroups gmane.comp.web.elinks.user
Message-ID <20090103185005.GA4572@pldmachine>
On Sat, Jan 03, 2009 at 06:12:01PM +0000, Dave Wood wrote:
> I've just caught the tail end of this thread since I haven't been on the
> list very long.
> 
> I copied all the .js files in smjs to ~/.elinks/ but on youtube I get a
> message saying my flash player is too old and another saying javascript is
> turned off.
> 
> Is there something else I need to do to get this working?
> 
> I'm using the current-0.13 from git as of today 3rd Jan and didn't specify
> any extra compile options.

Here is the youtube2.js. To get the better quality one could add
+ '&fmt=18' or even + '&fmt=22' after t[1].

/* Play videos at YouTube with minimal niggling. Just load the page for a video,
 * and the video will automatically be loaded. */
function load_youtube(cached, vs) {
	var par = cached.uri.match(/http:\/\/\w+\.youtube\.com\/watch\?v=([^&]+).*/);
	if (!par) return true;

	var t = cached.content.match(/, \"t\": \"([^"]+)\"/);
	if (!t) return true;

	var url = 'http://uk.youtube.com/get_video?video_id=' +  par[1] + '&t=' + t[1];

	cached.content = '<a href="' + url + '">View</a>';

	return true;
}
elinks.preformat_html_hooks.push(load_youtube);

/* When one tries to follow a link to <http://www.youtube.com/v/foo>,
 * redirect to <http://www.youtube.com/watch?v=foo>, which has the information
 * that is necessary to get the actual video file. */
function redirect_embedded_youtube(uri) {
	var uri_match = uri.match(/http:\/\/\w+\.youtube\.com\/v\/([^&]+).*/);
	if (!uri_match) {
		return true;
	}
	return 'http://uk.youtube.com/watch?v=' + uri_match[1];
}
elinks.follow_url_hooks.push(redirect_embedded_youtube);
/* end of file */

The last few lines of the ~/.elinks/hooks.js:

do_file(elinks.home + 'smartprefixes_bookmarks.js');
do_file(elinks.home + 'smartprefixes_classic.js');
do_file(elinks.home + 'youtube2.js');

The ELinks was built this way:
./autogen.sh && CFLAGS="-g2" ./configure --prefix=$HOME \
	--enable-debug \
	--disable-backtrace \
	--enable-true-color \
	--enable-256-colors \
	--without-lzma \
	--enable-bittorrent \
	--without-x \
	--enable-cgi \
	--without-lua \
	--with-python && make V=1

I don't know whether the --without-lua is meaningful here.
It works for me.
Does Scripting(SpiderMonkey ECMAScript) is shown in the About?

Witek
_______________________________________________
elinks-users mailing list
[email protected]
http://linuxfromscratch.org/mailman/listinfo/elinks-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.