Large

YouTube HD Ultimate

By Avindra V.G. Last update Dec 10, 2010 — Installed 402,073 times.

Archived Comments (locked)

in
Subscribe to Archived Comments 47 posts, 12 voices



Jesse Andrews Admin

The following is an archive of comments made before threaded discussions was implemented (November 16th, 2008)

 
JoeSimmons Scriptwright

Think you could combine Prevent Autoplay and this script? I would love it.

 
Avindra V.G. Script's Author

yeah, but sometimes, YouTube will "think" there's not HQ video available, even though there is one, so I have to include the xmlhttprequest as a backup.

 
Yansky Scriptwright

@avg, if you use this hack, you could probably avoid using an GM_xmlhttpRequest. - http://www.kottke.org/08/11/high-quality-youtub...

 
Compass User

Great Script!
There's this firefox addon called GoogleTube, where u can load youtube videos within a google search (without having to load up the page in a new tab)
Is there any way to tweak ur script so that when playing YouTube vids off Google it uses the high quality vid instead of the normal one?

Thanks

 
Avindra V.G. Script's Author

sure, i'll work on it when i have some time.

by the way, you'd look for #hq-link instead, so you can use $('hq-link') to see if the link is there.

 
Cleanlyness Scriptwright

Can you make it so YouTube profile videos display in high quality also? (example: www.youtube.com/CBS)

The YT CSS uses this.

.profile-hq-links{
text-align: right;
margin-top: 4px;
margin-bottom: -6px;
color: blue;
font-size: 11px;
font-weight: bold;width: 478px;
cursor: pointer;
cursor: hand;
}

 
Avindra V.G. Script's Author

the cookies probably have an expiry date. (they have that ability unfortunately)

 
scriptnoob User

i'm using this script because youtube doesn't save my setting! why does it not save my setting? i set my preference to high quality and it works for a few days but eventually resets. i have cookies enabled. using firefox 3. i'm not clearing my cookies either.

 
JoeSimmons Scriptwright

Yeah dkhal, that does create an image from a string, so the browser doesn't have to connect to a site to get it.

And about the former comments... The best way to get var1 is to use avg's method, just put a slash before the & though, like /\d+(?=\&var2)/, but the best way to get var2 (if the number is at the end of the url) is /\d+$/.

 
dkhal Scriptwright

thanks that's quite helpful
i think now i know all the things i need to code scripts and if i had anymore problems later i will consult you for help :)

 
dkhal Scriptwright

one more thing but not about regexp
i hope i'm not being too "pushy" lol
can you explain what this is?
background-image:url('data:image/gif;base64,R0lGODlhLwAwAJEAAPHp2vHr3PHm1/Hs3SH5BAAAAAAALAAAAAAvADAAAAL/nB2TFwECo5ygMWtATZX58VDaqEGhoHGA4jQnurlvd9S1I5VCgkfOS8HYhpfJDkFUGFeIhZP3PLxYtAsowuQxRqaUZxFaYIVXlLVnzEGl2AkyAHEigN00zdmOKAwQG9ocBgeoZrPEE1dIobQjyGHk51a20pCAdaL1ZalHWXYk4YHFx5jU0Ne5J4oiKGDzIqTShaowk5jTtKo3l6Z6YMTZadqrivgHE7TYU9sHxVtDyxZ682BR6VNjiZCHWn2ZcXJjzWI7YA036Xho6oqnCgYzGXaNB87LlYXDtPgWPtvhlU1M1IIrWeKlMoHpxqxIi2g8yHdikh1Ze+gcichmYLeH/+Dm0DjCRqIJBiA7OcrHx6OYVmZW5YOj0RrHaypTOmsZTUlMRDOz1QQxkOAiM9kghsJ1VKFFRyMzEO0x8FjQN0BINuspaB8ij/0GrsK0lSCGhxoWliQ3z6q/EvcMlopWriW6oU59sDuLbWggJCbC6WBldZm4KnWbFia6ZVQ1fuSGHSn2FyGyEMqevv2ky07UCb/osBzjQUdZr7hQNn7Et2mcqUUAf9sMMsS5xX8T7nH52kK3dFOXIGsELBjApmIAJw4VaOSM3gyLyzErQjOSoYSgveRhUerOyPc6ZZH1Q/a/23XFpAiKFDEGas+FTFmDPXu7JKTSIyFhidKP6vSh9xs1vtwHqNhBAhcoBEEMWXcQgd0uu6SwloADFAAAOw==')
i know what the CSS part is just usually i use URL in the second part of the CSS just this is something unusual to me
i think its a code to make firefox create an image coz it doesnt require a connection to the internet to work so it must be local
so is that it? and if so what language is it and how can i something like it?
if you heard of a manual for that it would be perfect

 
dkhal Scriptwright

no here is fine i just want to be informed in some way that you replied (it would be better if they did some sort of inbox here)
thanks a bunch
thats all i need
and i'm gonna use every bit you tought me in my newest updates
i couldnt have done it without you i mean it
i really appreciate it and the same goes to Joe who has been next to me from my first start in userscripts
i will keep in touch with you guys and hopefully i won't have any more problems
lol email would be better
thanks again

 
Avindra V.G. Script's Author

ah see someone would tell you use use .split("&") or something, but you'd have to do a couple of splits, arrays, and possibly substrings.

this regex formula:

/\d+(?=&var2)/

should do the trick on the example you provided for finding the value of var1. ?= is negative lookahead, meaning it will stop when it finds that, but it won't include that in the search.

for the second number, you can do:

/var2=\d+/

// then after you have the matched string, run a :
// .replace("var2=","")

Unfortunately, positive lookbehind isn't supported natively in javascript, so you just have to trim off what you don't want afterwards.

for not matching just numbers.....

/var2=.+(?=&)?/

// then after you have the matched string, run a :
// .replace("var2=","")

As for the dollar-sign... that matches the end of a line, and in URLs there's only one line so I can't see how that's relevant.

FOR mimicking positive lookbehind's effects without treating match afterwards

ALSO, I've tried this:,

"page.php?var1=1456&var2=8941436".match(/var2=(.+)?(?=&)?/)

and using the second part of the array, you get the match you need, only the number. So:

"page.php?var1=1456&var2=8941436".match(/var2=(.+)?(?=&)?/)[1]

successfully returns what you're looking for. If you need anymore help, please email me instead lol. It's aavindraa@gmail.com.

 
dkhal Scriptwright

ok that worked quite fine so thanks for both your support
but actually the real page i need the script in has an address like this
URL = "page.php?var1=1456&var2=8941436"; for ex
how can i get 1st number apart and 2nd nbr apart too in the simplest way (with using subtr and indexOf if possible) thats my problem
i saw a method somewhere its by matching /var1=\d+/ and inserting a $ somewhere to perform a match on that number only

 
Avindra V.G. Script's Author

Joe is right, you can use:

/\d+/

or

/[0-9]+/

Those are your two best choices; i prefer the first.

 
JoeSimmons Scriptwright

var S = "page.php?var=1456";
var num = S.match(/\d+/);

 
dkhal Scriptwright

one more quest if you have a string S="page.php?var=1456";
i want to get the 1456 using regexp i'm trying to use this but it doesnt give me the number only
num=S.match(/\w+.w+\?var=/);
i know i'm missing smthing in the exp so can you help me out and post it on my Youtube script
thx

 
JoeSimmons Scriptwright

Yeah that's perfect.

 
Avindra V.G. Script's Author

hey joe,

i changed the links to be found with xpath. is that the best xpath "formula" to use?

thanks.

 
JoeSimmons Scriptwright

Cool. but I still think you're being very stubborn about the script source.

 
Avindra V.G. Script's Author

Ok, but I will compress my scripts regardless :P

but about your previous problem with some videos not working, could you please update to this version and see if it works now? it works on my end.

This is the video that wasn't working for you.

 
JoeSimmons Scriptwright

Compressing this script serves no purpose. Dial-up can even download the un-compressed source in one second.

 
Avindra V.G. Script's Author

this will sum up to 0.0001s (0.1ms) for skipping over all comments and whitespace.
That's good enough for me ;)

 
prof7bit Scriptwright

@avg: The compiler, in its very first step of scanning the source code, will execute a loop where it reads from beginning to end character for character and compare it to what it is expecting next (what the syntax and grammar of the language will allow there to be next). If it is inside a comment started with // it will only have to look for the next newline. It will loop and read the next characher and compare it just to [\r|\n] and nothing else until it finds one. This loop is written in C++ and compiled to *optimized* machine code. I would roughly estimate a maximum of 20 clock cycles per character for this loop, outside of a comment it will be a lot more work because more possible options exist and some things have to be stored and compared with each other and a syntax tree has to be built, but inside comments (and whitespace) it can go *very* fast from character to character.

If we assume a file with 10k worth of comments and whitespace on a 2GHz Machine this will sum up to 0.0001s (0.1ms) for skipping over all comments and whitespace. This is about the time it takes for your 70Hz CRT monitor to draw 7 (seven) of it's 1024 lines. The removing of this huge ammount whitespace could happen 1000 (thousand) times in a row within one twinkle of the eye (100ms).

This all has to be done only once. After scanning, parsing and compiling to bytecode it will then finally be executed by SpiderMonkey, mozilla's JavaScript virtual machine.

The only reason for "compressing" scripts this way is when you serve big scripts via slow internet connections (and even here the better solution would be serving it gzipped instead of plain), but slow connections are obviously not the case here. Firefox itself is full of tons of javascript that drive it's user interface and none of it is "compressed" this way.

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel