Reply
Thread Tools
Addison's Avatar
Posts: 3,811 | Thanked: 1,151 times | Joined on Oct 2007 @ East Lansing, MI
#1
Hey guys.

I love this script on my Windows XP computer.


javascript:(function() {
function get_filetype(fmt_id) {
switch(fmt_id) {
case '5':
case '34':
case '35':
return 'FLV';
case '18':
case '22':
case '37':
case '38':
return 'MP4';
default:
return 'unknown';
}
}
function get_video_url(fmt_url_map, chosen_fmt_id) {
fmt_url_map=fmt_url_map.substring(fmt_url_map.inde xOf(chosen_fmt_id+'|')+chosen_fmt_id.length+1);
if(fmt_url_map.indexOf(',')!==-1) {
return fmt_url_map.substring(0, fmt_url_map.indexOf(','));
} else {
return fmt_url_map;
}
}
(function main() {
var args=yt.getConfig('PLAYER_CONFIG')['args'];
var fmt_quality_list='';
var chosen_fmt_id=0;
var fmt_info=args['fmt_list'].split(',');
var fmt_resolution='';
var avail_fmt_ids=new Array(fmt_info.length);
for(var i in fmt_info) {
avail_fmt_ids[i]=fmt_info[i].split('/')[0];
fmt_resolution=fmt_info[i].split('/')[1];
fmt_quality_list+=(avail_fmt_ids[i]+' = '+fmt_resolution+' ('+get_filetype(avail_fmt_ids[i])+')\n');
}
loop: while(true) {
chosen_fmt_id=prompt('Please enter a format id.\n'+fmt_quality_list, avail_fmt_ids[0]);
if(chosen_fmt_id===null) {
return;
}
for(var i in avail_fmt_ids) {
if(chosen_fmt_id===avail_fmt_ids[i]) {
break loop;
}
}
}
window.open(get_video_url(args['fmt_url_map'], chosen_fmt_id)+'&title='+document.getElementsByNam e('title')[0].content);
}());
}());


Just go to a Youtube video and simply copy and paste that in the address bar. :)

So yeah, is there any way to inject this into Tear or MicroB?

I'm really hoping for a response on this. :)

Last edited by Addison; 2011-06-19 at 01:16.
 

The Following User Says Thank You to Addison For This Useful Post:
Addison's Avatar
Posts: 3,811 | Thanked: 1,151 times | Joined on Oct 2007 @ East Lansing, MI
#2
What I posted is written in Javascript and not Java, correct?

So in theory, it should work, yes?

Has anyone tried this just once on a Youtube video using their Windows computer?
 
Posts: 670 | Thanked: 367 times | Joined on Mar 2009
#3
I haven't tried it, but at first blush it looks like a bookmarklet. I would create a bookmark and paste that whole thing (sans spaces and line feeds) into the bookmark URL. Then, pull up your video and then select the bookmark.
__________________
* n810 since Feb 2009
* Most-used apps: Opera, gPodder, Panucci, Tomiku, Canola, Quasar, MaemoMapper, ATI85, Maemopad+, AisleRiot Solitaire, Anagramarama, Rapier, Gnumeric, pyRDesktop
* Mobile-friendly URLs of popular sites
 

The Following User Says Thank You to buurmas For This Useful Post:
Addison's Avatar
Posts: 3,811 | Thanked: 1,151 times | Joined on Oct 2007 @ East Lansing, MI
#4
You really, really, really should just try this on a computer.

I think it would give you happy giggles!

Anyway, I tried pasting that script in the browser address bar thingy in both MicroB and Tear but it appears that it's too big for both of them to handle.

But still, thanks for the response buurmas!
 
Addison's Avatar
Posts: 3,811 | Thanked: 1,151 times | Joined on Oct 2007 @ East Lansing, MI
#5
*Testing*


javascript:(function() {function get_filetype(fmt_id) {switch(fmt_id) {case '5':case '34':case '35':return 'FLV';case '18':case '22':case '37':case '38':return 'MP4';default:return 'unknown';}}function get_video_url(fmt_url_map, chosen_fmt_id) {fmt_url_map=fmt_url_map.substring(fmt_url_map.ind exOf(chosen_fmt_id+'|')+chosen_fmt_id.length+1);if (fmt_url_map.indexOf(',')!==-1) {return fmt_url_map.substring(0, fmt_url_map.indexOf(','));} else {return fmt_url_map;}}(function main() {var args=yt.getConfig('PLAYER_CONFIG')['args'];var fmt_quality_list='';var chosen_fmt_id=0;var fmt_info=args['fmt_list'].split(',');var fmt_resolution='';var avail_fmt_ids=new Array(fmt_info.length);for(var i in fmt_info) {avail_fmt_ids[i]=fmt_info[i].split('/')[0];fmt_resolution=fmt_info[i].split('/')[1];fmt_quality_list+=(avail_fmt_ids[i]+' = '+fmt_resolution+' ('+get_filetype(avail_fmt_ids[i])+')\n');}loop: while(true) {chosen_fmt_id=prompt('Please enter a format id.\n'+fmt_quality_list, avail_fmt_ids[0]);if(chosen_fmt_id===null) {return;}for(var i in avail_fmt_ids) {if(chosen_fmt_id===avail_fmt_ids[i]) {break loop;}}}window.open(get_video_url(args['fmt_url_map'], chosen_fmt_id)+'&title='+document.getElementsByNam e('title')[0].content);}());}());
 
Addison's Avatar
Posts: 3,811 | Thanked: 1,151 times | Joined on Oct 2007 @ East Lansing, MI
#6
Hmmmmmmmm....

*Another test*

Javascript.txt

EDIT:

Okay, if you download the attachment, open it with Notepad, Select all, copy then paste it into a Youtube video, it works.

I'm not sure why the other ones that were posted don't seem to do anything.

Last edited by Addison; 2011-06-21 at 04:25.
 
Posts: 141 | Thanked: 41 times | Joined on Apr 2011 @ Ahmedabad, India
#7
Here's the simplest way to download youtube videos on your PC

To download any video on youtube, go to that url and simply replace y from youtube to 3 ..

eg. video of Hello by Lionel Richie is at http://www.youtube.com/watch?v=PDZcqBgCS74

to download that video go to address bar and type
http://www.3outube.com/watch?v=PDZcqBgCS74

you shall get options to download the video in different formats.

Enjoy !
Note: Download option won't be available for copyright videos !
 

The Following User Says Thank You to dtparikh For This Useful Post:
Addison's Avatar
Posts: 3,811 | Thanked: 1,151 times | Joined on Oct 2007 @ East Lansing, MI
#8
^ Are you completely sure about this?

It just times out on my end.

I used Firefox and Explorer, both of them just give me a problem loading page, even with your link you provided.

Is there a special plug-in or something required for this?
 
Addison's Avatar
Posts: 3,811 | Thanked: 1,151 times | Joined on Oct 2007 @ East Lansing, MI
#9
Okay. So it looks like both the 640x360 .flv and .mp4 is too much for the older tablet.

Anyway, here's probably the best script for us unless someone knows of something better.

Just copy and paste this in your browser on a Youtube page.


javascript:isIE=/*@cc_on!@*/false;isIE ? swfHTML=document.getElementById('movie_player').ge tElementsByTagName('param')[1].value:swfHTML=document.getElementById("movie_play er").getAttribute("flashvars");w=swfHTML.split("&" );for(i=0;i<=w.length-1;i++)if(w[i].split("=")[0] == "fmt_url_map"){links=unescape(w[i].split("=")[1]);break;}abc = links.split(",");for(i=0;i<=abc.length-1;i++){fmt=abc[i].split("|")[0];if(fmt==5){url = abc[i].split("|")[1] + '&title=' + (((document.title.replace('#',' ')).replace('@',' ')).replace('*',' ')).replace('|',' ');window.location.href = url;}}


Post any feedback if bored. :)
 

The Following User Says Thank You to Addison For This Useful Post:
Addison's Avatar
Posts: 3,811 | Thanked: 1,151 times | Joined on Oct 2007 @ East Lansing, MI
#10
Poopers.

I think posting in this forum changes some of the spacing or coding.

Anyway, this should work.
Youtube Download.txt
 

The Following 2 Users Say Thank You to Addison For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 10:44.