Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
Using the Copy feature to copy just video URL's
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  7 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Mary  
View profile  
 More options Jun 2 2006, 10:25 pm
From: "Mary" <sarah19...@gmail.com>
Date: Sat, 03 Jun 2006 02:25:01 -0000
Local: Fri, Jun 2 2006 10:25 pm
Subject: Using the Copy feature to copy just video URL's
Hi!

Right now my hello world sample + callback handler is putting the video
html into a DIV called saved_results. I'd like to put just the video
URL into a text form field, not the video HTML into a DIV.

Any help?

Here is the code thus far:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="content-type" content="text/html;
charset=utf-8"/>
    <title>Hello World - Google AJAX Search API Sample</title>
    <link href="http://www.google.com/uds/css/gsearch.css"
type="text/css" rel="stylesheet"/>
    <style type="text/css">

    body {
      background-color: white;
      color: black;
      font-family: Arial, sans-serif;
      font-size: small;
      margin: 15px;
    }

    </style>
    <script
src="http://www.google.com/uds/api?file=uds.js&v=0.1&key=YOURKEYHERE"></script>

    <script type="text/javascript">
    //<![CDATA[

    function OnLoad() {
      // Create a search control
      var searchControl = new GSearchControl();

      // Add in a full set of searchers
      var localSearch = new GlocalSearch();
      searchControl.addSearcher(new GvideoSearch());
      // Set the Local Search center point
     // localSearch.setCenterPoint("Atlanta, GA");

        // establish a keep callback
        searchControl.setOnKeepCallback(this, MyKeepHandler);

      // tell the searcher to draw itself and tell it where to attach
      searchControl.draw(document.getElementById("searchcontrol"));

      // execute an inital search
      searchControl.execute("Bloc Party");
    }

//luis
      function MyKeepHandler(result) {

        // clone the result html node
        var node = result.html.cloneNode(true);
var someURL = result.url.cloneNode(true);

        // attach it
        var savedResults = document.getElementById("saved_results");
        savedResults.appendChild(node);
      }
//luisend

    //]]>
    </script>
  </head>
  <body onload="OnLoad()">
My Saved Results:
    <div id="saved_results"/>

Search Videos:
    <div id="searchcontrol"/>
  </body>
</html>

Just a reminder about my goal: I'd like to put just the video URL into
a text form field, not the video HTML into a DIV.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
mhl  
View profile  
 More options Jun 3 2006, 10:46 am
From: "mhl" <mhl...@gmail.com>
Date: Sat, 03 Jun 2006 07:46:12 -0700
Local: Sat, Jun 3 2006 10:46 am
Subject: Re: Using the Copy feature to copy just video URL's
Did you get my note on the blog you originally posted this question on?

When your keep handler is called, you are passed a result object. Your
current code, which is cloning the node and attaching it is using only
the .html property.

If you want to access the other properties (like duration, url, title,
thumbnail, etc.) you can easily do that. result.url is probably what
you are after.

Note, that if you only want to do this special processing for video
search results, make sure you test the result type:

if ( result.GsearchResultClass == GvideoSearch.RESULT_CLASS ) {
  // its a video search result...

}

Now, the thing I don't understand about your question is what exactly
are you trying to do? Why do you want to put the URL only into a text
input form field? Typically these elements are used if you intend to
edit the content. Video URLs are very nasty looking URLs. They are very
large and should definitely not be visible to end users.

One other thing that you might want to explore is how you can use CSS
to control whats visible in a given search result. I apologize that all
of the styles are not in the written documentation, but the gsearch.css
is pretty well documented and between that and the My Favorite Places
V2 sample code you should be able to get a feel for how you can use CSS
for this. Look specifically at what we did to twiddle the web search
result details between a view that shows just the hyper-linked title,
vs. the title, snippet, visible url, attribution watermark, etc.

If all you are trying to do is clip a video search result, transmit it
to your server to save it, and then refresh your page, you can clip the
entire result into a hidden form field, round trip the page, and then
use CSS styling to show only the hyper-linked title.

Let me know more about what you are really after. The HTML that is
generated for a search result is heavily marked up with classes and is
designed to let you apply extensive styling without having to write a
lot of code.

I


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mary  
View profile  
 More options Jun 3 2006, 6:51 pm
From: "Mary" <sarah19...@gmail.com>
Date: Sat, 03 Jun 2006 22:51:18 -0000
Local: Sat, Jun 3 2006 6:51 pm
Subject: Re: Using the Copy feature to copy just video URL's
We are going to have someone else take a look this weekend, because the
two of us who've tried to implement this so far don't know
JavaScript/DOM well. I've tried putting result.url in the callback
handler (      function MyKeepHandler(result.url) {
) to show up in the div without modifying anything else, but that does
not work.

We're trying to allow people to just "clip" the URL, post it to a form,
so it can be written to a database, so they can view it on their site
profile. We already have this functionality working with youTube's API,
and we'd like to do the same with google's API.

Hiding fields with CSS wouldn't really help us since we just want the
URL in the database.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
mhl  
View profile  
 More options Jun 4 2006, 11:54 pm
From: "mhl" <mhl...@gmail.com>
Date: Mon, 05 Jun 2006 03:54:35 -0000
Local: Sun, Jun 4 2006 11:54 pm
Subject: Re: Using the Copy feature to copy just video URL's
Here you go. I assumed you wanted more than just a single video per
profile, thats why I was suggesting that you grab the entire .html
property and push it into your database. If you only really need the
single video, here is a fragment that grabs the title and url and puts
them into an input element where you can then post to your server.

Good luck.

assume you have two input elements, first one whose id is "myTitle" and
the other, "myUrl"

function MyKeepHandler(result) {
 var myTitleElement = document.getElementById("myTitle");
 var myUrlElement = document.getElementById("myUrl");

 if ( result.GsearchResultClass == GvideoSearch.RESULT_CLASS ) {
  // its a video search result...
  myTitleElement.value = result.titelNoFormatting;
  myUrlElement.value = result.url;

  // submit form?
 }


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
wee...@gmail.com  
View profile  
 More options Jun 5 2006, 7:35 pm
From: wee...@gmail.com
Date: Mon, 05 Jun 2006 23:35:30 -0000
Local: Mon, Jun 5 2006 7:35 pm
Subject: Re: Using the Copy feature to copy just video URL's
Thank you. It worked for us once I used your change but .innerHTML for
the elements, and for anyone else using this result.titleNoFormatting
was misspelled :).

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
wee...@gmail.com  
View profile  
 More options Jun 16 2006, 2:29 am
From: wee...@gmail.com
Date: Thu, 15 Jun 2006 23:29:29 -0700
Local: Fri, Jun 16 2006 2:29 am
Subject: Re: Using the Copy feature to copy just video URL's
Let me clarify as well to anyone who ends up wanting to use this code.
.innerHTML works for div's, .value works for form fields (i.e.
myUrlElement.value = result.url; )

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ubaidx@gmail.com  
View profile  
 More options Jun 23 2006, 10:42 am
From: "uba...@gmail.com" <uba...@gmail.com>
Date: Fri, 23 Jun 2006 14:42:46 -0000
Local: Fri, Jun 23 2006 10:42 am
Subject: Re: Using the Copy feature to copy just video URL's

> assume you have two input elements, first one whose id is "myTitle" and
> the other, "myUrl"

> function MyKeepHandler(result) {
>  var myTitleElement = document.getElementById("myTitle");
>  var myUrlElement = document.getElementById("myUrl");

>  if ( result.GsearchResultClass == GvideoSearch.RESULT_CLASS ) {
>   // its a video search result...
>   myTitleElement.value = result.titelNoFormatting;
>   myUrlElement.value = result.url;

>   // submit form?
>  }
> }

Respected Sir.. can you please solve my problem related to your post of
june 2

By using the colde below I couldn't print the url in the appropriate
div tag. Can you tell me whats wrong with the callback method. I will
really appreciate your help. Obaid
 var drawOptions = new GdrawOptions();
      drawOptions.setDrawMode(GSearchControl.DRAW_MODE_TABBED);
       searchControl.setOnKeepCallback(this, MyKeepHandler);

      searchControl.draw(document.getElementById("searchcontrol"),
drawOptions);

      // Execute an inital search
      searchControl.execute("Google");

     }

// establish a keep callback

function MyKeepHandler(result) {

var newr = result.url.cloneNode(true);
var myUrlElement = document.getElementById("myUrl");

 if ( result.GsearchResultClass == GvideoSearch.RESULT_CLASS ) {
  myUrlElement.appendchild(newr);

 }

}

   //]]>
    </script>
  </head>
  <body onload="OnLoad()">
 <div id="myUrl"/>
<div id="searchcontrol"/>
 </body>
</html>

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »