Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Userscript oneliner challenge

Name: Anonymous 2011-10-24 4:31

Write one line of javascript which will provide download options to any youtube video page.

Name: Anonymous 2011-10-24 4:34

Why don't we make a single [CHALLENGE] thread as any decent 2channel-user wannabe would instead of polluting the board?

Name: Anonymous 2011-10-24 4:40

Whoever makes the shortest oneliner wins.

Name: Cudder !MhMRSATORI!FBeUS42x4uM+kgp 2011-10-24 4:58

Take the swf videoplayback parameters, URLdecode it thrice, and split them into <a> tags by codec.

Name: Anonymous 2011-10-24 6:44

Name: Anonymous 2011-10-24 6:47

Special:Contest

Name: Anonymous 2011-10-24 7:17

>>1
>Write me a youtube downloader
Suck my cock dude

Name: Anonymous 2011-10-24 7:53

how about i program you a dick and
then go::fuckyourself(with it)

Name: Anonymous 2011-10-24 7:57

>>8
(let ((dick (make-dick)))
  (fuck (dick (post-author (get-post *current-thread* 1)))))

Name: Anonymous 2011-10-24 8:00

>>9
Dicks are not functions!

Name: Anonymous 2011-10-24 8:01

>>10
true

Name: Anonymous 2011-10-24 8:06

>>10
Code as data. Data as code.

Name: Anonymous 2011-10-24 8:10

>>12
whats your pl0x buddy?

Name: Anonymous 2011-10-24 8:14

>>10
FUCK is a macro which uses the structure of its arguments to select the correct intercourse.
(fuck (dick me)) puts ME under DICK.
(fuck (me dick)) puts ME on top of DICK.
(fuck me dick) puts ME next to DICK.
(fuck vipper anonymous leah-culver) is a daisy-chain.
It assumes one level of nesting, so (fuck (vipper (anonymous (leah))) doesn't produce the desired result.

Name: Anonymous 2011-10-24 8:30

>>14
Autism.

Name: Anonymous 2011-10-24 8:37

>>14
[...] a macro which uses the structure of its arguments [...]
Your macro is bad and you should feel bad about it.

Name: FrozenVoid 2011-10-24 8:50

//Could be shorter without format types(I actually use unrolled version)
unescape(XPCNativeWrapper.unwrap(unsafeWindow.document.getElementById("movie_player").attributes.flashvars).value.split("&").sort(function(a,b){return a.length==b.length?0:a.length>b.length?-1:1})[0].split("=")[1]).split("&").filter(function (e,i,a){return e.search("itag=")!=-1 }).forEach(function(e,i,a){if(e.length<10) return; s=e.split(",");f={35:"854x480 HQ flv", 5:"400x226 LowestQ flv", 34:"640x360 Med flv", 18:"480x360 LowQ mp4", 38:"4096x3072 ULTRA mp4", 37:"1920x1080 HD mp4", 22:"1280x720  HD mp4",  6:"480x360 mono flv",  13:"176x144 Mobile mono ",  17:"176x144 Mobile stereo" };unsafeWindow.document.getElementById("movie_player").parentNode.parentNode.parentNode.innerHTML+=("<a href='"+unescape(s[1].split("=")[1])+"&title="+document.title+"'>Format:"+f[s[0].match(/\d+/)[0]]+"</a><br>");})

Name: Anonymous 2011-10-24 8:54

//fixed typo
unescape(XPCNativeWrapper.unwrap(unsafeWindow.document.getElementById("movie_player").attributes.flashvars).value.split("&").sort(function(a,b){return a.length==b.length?0:a.length>b.length?-1:1})[0].split("=")[1]).split("&").filter(function (e,i,a){return e.search("itag=")!=-1 }).forEach(function(e,i,a){if(e.length<10) return; s=e.split(",");ft={ 35:"854x480 HQ flv", 5:"400x226 LowestQ flv", 34:"640x360 Med flv", 18:"480x360 LowQ mp4", 38:"4096x3072 ULTRA mp4", 37:"1920x1080 HD mp4", 22:"1280x720  HD mp4",  6:"480x360 mono flv",  13:"176x144 Mobile mono ",  17:"176x144 Mobile stereo" };unsafeWindow.document.getElementById("movie_player").parentNode.parentNode.parentNode.innerHTML+=("<a href='"+unescape(s[1].split("=")[1])+"&title="+document.title+"'>Format:"+ft[s[0].match(/\d+/)[0]]+"</a><br>");})

Name: Anonymous 2011-10-24 8:57

cram everything onto one line

go back to #esolangs you fucking kiddies

Name: FrozenVoid 2011-10-24 9:17

//minified version without user-friendly format strings and slightly reduced code size.
unescape(XPCNativeWrapper.unwrap(unsafeWindow.document.getElementById("movie_player").attributes.flashvars).value.split("&").sort(function(a,b){return b.length-a.length})[0].split("=")[1]).split("&").filter(function(e,i,a){return e.search("itag=")!=-1 }).forEach(function(e,i,a){if(e.length>10){s=e.split(",");unsafeWindow.document.getElementById("movie_player").parentNode.parentNode.innerHTML+=("<a href='"+unescape(s[1].split("=")[1])+"&title="+document.title+"'>"+s[0].match(/\d+/)[0]+" </a>")}})

Name: >>9,14 2011-10-24 9:17

>>15,16
I know it's terrible!
In fact I made that up and the call to dick was a typo. FUCK is actually a generic method.

Name: Anonymous 2011-10-24 9:26

>>20
>500 bytes
Bloatware

Name: FrozenVoid 2011-10-24 9:40

>>22 431 bytes now
unescape(document.getElementById("movie_player").attributes.flashvars.value.split("&").sort(function(a,b)b.length-a.length)[0].split("=")[1]).split("&").filter(function(e,i,a)e.search(/itag=\d\d/)!=-1 ).forEach(function(e,i,a){s=e.split(",");unsafeWindow.document.getElementById("movie_player").parentNode.parentNode.innerHTML+=("<a href='"+unescape(s[1].split("=")[1])+"&title="+document.title+"'>"+s[0].match(/\d+/)[0]+" </a>")})

Name: Anonymous 2011-10-24 9:51

//421 bytes since some arguments can be ommited
unescape(document.getElementById("movie_player").attributes.flashvars.value.split("&").sort(function(a,b)b.length-a.length)[0].split("=")[1]).split("&").filter(function(e)e.search(/itag=\d+,/)!=-1 ).forEach(function(e){s=e.split(",");unsafeWindow.document.getElementById("movie_player").parentNode.parentNode.innerHTML+="<a href='"+unescape(s[1].split("=")[1])+"&title="+document.title+"'>"+s[0].match(/\d+/)[0]+" </a>"})

Name: FrozenVoid 2011-10-24 9:54

//396 bytes beat this
unescape(document.getElementById("movie_player").attributes.flashvars.value.split("&").sort(function(a,b)b.length-a.length)[0].split("=")[1]).split("&").filter(function(e)e.search(/itag=\d+,/)!=-1 ).forEach(function(e){s=e.split(",");unsafeWindow.document.getElementById("eow-title").innerHTML+="<a href='"+unescape(s[1].split("=")[1])+"&title="+document.title+"'>"+s[0].match(/\d+/)[0]+" </a>"})

Name: Anonymous 2011-10-24 10:02

>>23-25
Gives error.

Name: Anonymous 2011-10-24 10:02

//379 bytes
unescape(document.getElementById("movie_player").attributes.flashvars.value.split("&").sort(function(a,b)b.length-a.length)[0].split("=")[1]).split("&").filter(function(e)e.search(/\d+,u/)!=-1 ).forEach(function(e){s=e.split(",");document.getElementById("eow-title").innerHTML+="<a href='"+unescape(s[1].split("=")[1])+"&title="+document.title+"'>"+s[0].match(/\d+/)[0]+" </a>"})

Name: Anonymous 2011-10-24 10:13

//360 bytes
unescape(document.getElementById("movie_player").attributes.flashvars.value.split("&").sort(function(a,b)b.length-a.length)[0].split("=")[1]).split("&").filter(function(e)e.search(/\d,u/)!=-1).forEach(function(e){s=e.split(",");document.getElementById("eow-title").innerHTML+="<a href='"+unescape(s[1].split("=")[1])+"&title="+document.title+"'>"+s[0]+"</a>"})

Name: Anonymous 2011-10-24 10:15

For fun, try finding a download addon for youtube which is below 100kb on Mozillas site.

Name: Anonymous 2011-10-24 10:21

>>28
Still gives error, also u=unescape; and replace all the unescape with u.

Name: FrozenVoid 2011-10-24 10:27

//This one is the original from which the script is constructed:

// ==UserScript==
// @id             Youtube
// @name           YoutubeDownloader
// @version        1.0
// @namespace     
// @author         FrozenVoid
// @description    download video in any format with correct title
// @include        http://www.youtube.com/watch*;
// @run-at         document-end
// ==/UserScript==

a=XPCNativeWrapper.unwrap(unsafeWindow.document.getElementById("movie_player").attributes.flashvars)
a=a.value.split("&");
function longest(a,b){
if (a.length==b.length) return 0;
if(a.length>b.length) return -1;
return 1;
}
a=a.sort(longest);

a=a[0];
a=a.split("=")[1];
a=unescape(a).split("&");
function haslink(e,i,a){return e.search("itag=")!=-1 }
a=a.filter(haslink);
j=[];
function construct(e,i,a){
if(e.length<10) return;
s=e.split(",");
fmtmap={
43:"640x360  WebM med",
44:"854x480 WebM HQ",
45:"1280x720  WebM HD",
35:"854x480 HQ flv",
5:"400x226 LowestQ flv",
34:"640x360 Med flv",
18:"480x360 LowQ mp4",
38:"4096x3072 ULTRA mp4",
37:"1920x1080 HD mp4",
22:"1280x720  HD mp4",
 6:"480x360 mono flv",
 13:"176x144 Mobile mono ",
 17:"176x144 Mobile stereo"
}

dfmt=fmtmap[s[0].match(/\d+/)[0]];
if(!dfmt){dfmt="Unknown Format:"+s[0].match(/\d+/)[0];}
nref="<a href='"+unescape(s[1].split("=")[1])+"&title="+document.title+"'>Format:"+dfmt+"</a><br>";
j.push(nref);}
a.forEach(construct);
unsafeWindow.document.getElementById("movie_player").parentNode.parentNode.parentNode.innerHTML=j;

Name: Anonymous 2011-10-24 10:33

>>5
The contest user interface uses JavaScript. Your browser does not support JavaScript or JavaScript is disabled.
NO THANK YOU

Name: Anonymous 2011-10-24 10:34

Today, 2011-10-24 at 10:27 /prog/-time, FrozenVoid posted code in [code] tags.

Name: FrozenVoid 2011-10-24 10:41

>>33
I don't usually need code tags to read it(i use verdana everywhere), its for the pedants who want monospaced text but too lazy to configure their browser to default to it.

Name: Anonymous 2011-10-24 13:08

>>34
please enter >>5

Name: FrozenVoid 2011-10-24 13:48

>>35
I hate wikibureaucrats and their little pet projects.

Name: Anonymous 2011-10-24 14:52

here ya go bitch
time for some cocaine

$.get(/%http://(?:\S+\.swf\b|\S+?youtube\S+)%$/.html(),);

Name: Anonymous 2011-10-24 20:30

>>37
Don't talk about cocaine or freebase unless YOU GOT SOME

Name: FrozenVoid 2011-10-25 14:55

Someone was dumb enough to use oneliner for a released script
(a vimeo downloader, not minified but dense http://userscripts.org/scripts/review/112123 ).
http://pastebin.com/4eUR7mjT fixed version

Name: Anonymous 2011-10-25 15:03

>>39
oneliner my ass i need a 40" widescreen
with 9*9 bitmap size to consider this oneliner

Don't change these.
Name: Email:
Entire Thread Thread List