It looks like you're using an Ad Blocker.

Please white-list or disable AboveTopSecret.com in your ad-blocking tool.

Thank you.

 

Some features of ATS will be disabled while you continue to use an ad-blocker.

 

Google Video ID extractor

page: 1
3

log in

join
share:

posted on Mar, 1 2007 @ 10:06 PM
link   
It's basically the same idea as the YouTube Video ID extractor.

In fact, the concept proof can be found at the same website.

Relevant JavaScript is below:

function gvidIDextract(url)
[
var gvid_id;
gvid_id = url.replace(/^[^=]+=(-?\d+).*/,"$1");
return gvid_id;
]

Again, if the admins here wish to use this code for ATS, they have my full permission.


Some URLs with which this will work:
Copy and paste link with right mouse button.
video.google.com...

Please test for corner cases I might have missed.

PS This one also doesn't mangle the ID if that's all that's inputted.

[edit on 3/1/2007 by supercheetah]

[edit on 3/1/2007 by supercheetah]



posted on Mar, 2 2007 @ 04:52 AM
link   
That’s looking pretty good. If it was used on the site it’d make embedding videos easier.

0 ?
id = url.replace(/^[^=]+=(-?\d+).*/,"$1") :
id = url.replace(/^[^v]+v.(.[11]).*/,"$1");

return id;
]



Of course that function assumes that they have added the address with http:// at the beginning




[edit on 2-3-2007 by Burgess]



posted on Mar, 3 2007 @ 02:32 AM
link   

Originally posted by Burgess
You could stick both of them into one function that would look something like the one below, then just have one button to add either Google video or youTube video.

-snip-

Of course that function assumes that they have added the address with http:// at the beginning
That's actually slower because it forces the browser to figure out which URL it's working on.

Nonetheless, I created a variant that's on the concept page. The following is takes inspiration from yours, doesn't require "http://", and it's self-documenting even though it is more code. On top of all that, it's easier to expand to more video sites.

Here's the new JavaScript code that I added:

function youtubeRE(url)
[
return url.replace(/^[^v]+v.(.[11]).*/,"$1");
]

function gvidRE(url)
[
return url.replace(/^[^=]+=(-?\d+).*/,"$1");
]

function IDextract(url)
[
if(url.match(/google/))
return gvidRE(url);
else
return youtubeRE(url);
]


[edit on 3/3/2007 by supercheetah]



posted on Mar, 3 2007 @ 06:20 AM
link   

Originally posted by Burgess
If it was used on the site it’d make embedding videos easier.


Forgive me if I am missing something, but what is any easier than typing...

[yvid]Number Here[yvid]

[gvid]Number Here[/gvid]



posted on Mar, 3 2007 @ 07:47 AM
link   

Originally posted by chissler

Originally posted by Burgess
If it was used on the site it’d make embedding videos easier.


Forgive me if I am missing something, but what is any easier than typing...

[yvid]Number Here[yvid]

[gvid]Number Here[/gvid]
Copying and pasting the URL and letting the browser determine the ID from the URL?



posted on Mar, 3 2007 @ 09:27 AM
link   

Originally posted by supercheetah
Copying and pasting the URL and letting the browser determine the ID from the URL?


Does that necessarily equate to easier?



posted on Mar, 3 2007 @ 08:02 PM
link   

Originally posted by chissler

Originally posted by supercheetah
Copying and pasting the URL and letting the browser determine the ID from the URL?


Does that necessarily equate to easier?
Yes it is because it doesn't require people to be human regular expression parsers.



new topics

top topics



 
3

log in

join