Results 1 to 7 of 7

Thread: Google Video Sitemap

  1. #1
    Join Date
    Mar 2008
    Location
    Dayton, Ohio
    Posts
    52

    Default Google Video Sitemap

    Code:
    <?php 
    
    include("include/config.php");
    
    $VID=$_REQUEST[VID];
    
    $query = "select * from video where type='public' and active='1' and approve='1'"; 
    		  
    $db=mysql_connect ($db_host,$db_user,$db_pass) or die ('I cannot connect to the database because: ' . mysql_error());
    mysql_select_db ($db_name);  
    $num_rows = mysql_num_rows(mysql_query("select * from video WHERE AND active = '1' and approve='1'")); 
    $result = mysql_query($query) or die ('Query Error: ' . mysql_error()); 
     
    header("Content-Type: text/xml"); 
    header("Expires: 0");
    
    print "<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\" xmlns:video=\"http://www.google.com/schemas/sitemap-video/1.0\">\n";
    
    while ($results = mysql_fetch_array($result)) 
    { 
    	$title = $results['title']; 
    	$viewkey = $results['vkey'];
    	$VID = $results['VID'];
    	$video = $results['flvdoname'];
    	$duration = $results['duration'];
    	$description = $results['description'];
    
    print "<url>\n";
    print "<loc>\n";
    print "http://www.YOURSITE.com";
    print "/";
    print "view";
    print "/";
    print "$VID";
    print "/";
    print "$title";
    print "/";
    print "</loc>\n";
    print "<video:video>\n";
    print "<video:content_loc>http://www.YOURSITE.com/flvvideo/$video.flv</video:content_loc>";
    print "<video:player_loc allow_embed=\"yes\">http://www.YOURSITE.com/player/player.swf</video:player_loc>";
    print "<video:title>$title</video:title>";
    print "<video:description>$description</video:description>";
    print "<video:duration>$duration</video:duration>";
    print "<video:family_friendly>yes</video:family_friendly>";
    print "<video:thumbnail_loc>\n";
    print "http://www.YOURSITE.com";
    print "/";
    print "thumb/1_";
    print "$VID";
    print ".jpg";
    print "</video:thumbnail_loc>\n";
    print "</video:video>\n";
    print "</url>\n";
    
    } 
    mysql_close(); 
    
    print "</urlset>\n";
    
    ?>
    Ok if you don't have a Google Webmaster Tools account that is the first thing you are missing. Set one up; http://www.google.com/webmasters/tools/

    Once that is set up, create a new file and copy and paste the above code into the the new file. Make sure you update the URL within the code to reflect your site. Save and upload the new file to the root directory of your site.

    Now go back to our Google Webmasters Tools account and add a site. Then go to Sitemaps and click 'Add a sitemap'. Submit the URL to the sitemap file you just created. Give Googlebot some time to crawl your sitemap and sit back and watch the indexed videos roll in.

  2. #2
    Join Date
    Aug 2008
    Posts
    21

    Default Re: Google Video Sitemap

    yea i got 1 small probelm with this, the code dosnt out put the correct video urls

    <video:content_loc>http://www.vidzspot.com/flvvideo/.flv</video:content_loc>

    its missing the file name

  3. #3
    Join Date
    Mar 2008
    Location
    Dayton, Ohio
    Posts
    52

    Default Re: Google Video Sitemap

    Aw shucks. Thanks for pointing that out. There is was a typo when assigning the $video variable. I already corrected the problem in the code above.

    Problem was:
    $video = $results['flvdovideo'];
    Corrected:
    $video = $results['flvdoname'];

    Thanks dude.

  4. #4
    Join Date
    Aug 2008
    Posts
    21

    Default Re: Google Video Sitemap

    Shouldnt it be

    Code:
    <?php
    
    include("include/config.php");
    
    $VID=$_REQUEST[VID];
    
    $query = "select * from video where type='public' and active='1' and approve='1'";
           
    $db=mysql_connect ($db_host,$db_user,$db_pass) or die ('I cannot connect to the database because: ' . mysql_error());
    mysql_select_db ($db_name); 
    $num_rows = mysql_num_rows(mysql_query("select * from video WHERE AND active = '1' and approve='1'"));
    $result = mysql_query($query) or die ('Query Error: ' . mysql_error());
    
    header("Content-Type: text/xml");
    header("Expires: 0");
    
    print "<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\" xmlns:video=\"http://www.google.com/schemas/sitemap-video/1.0\">\n";
    
    while ($results = mysql_fetch_array($result))
    {
       $title = $results['title'];
       $viewkey = $results['vkey'];
       $VID = $results['VID'];
       $video = $results['flvdoname'];
       $duration = $results['duration'];
       $description = $results['description'];
    
    print "<url>\n";
    print "<loc>\n";
    print "http://www.YOURSITE.com";
    print "/";
    print "view";
    print "/";
    print "$VID";
    print "/";
    print "$title";
    print "/";
    print "</loc>\n";
    print "<video:video>\n";
    print "<video:content_loc>http://www.YOURSITE.com/flvideo/$video</video:content_loc>";
    print "<video:player_loc allow_embed=\"yes\">http://www.YOURSITE.com/player/player.swf</video:player_loc>";
    print "<video:title>$title</video:title>";
    print "<video:description>$description</video:description>";
    print "<video:duration>$duration</video:duration>";
    print "<video:family_friendly>yes</video:family_friendly>";
    print "<video:thumbnail_loc>\n";
    print "http://www.YOURSITE.com";
    print "/";
    print "thumb/1_";
    print "$VID";
    print ".jpg";
    print "</video:thumbnail_loc>\n";
    print "</video:video>\n";
    print "</url>\n";
    
    }
    mysql_close();
    
    print "</urlset>\n";
    
    ?>

  5. #5
    Join Date
    Mar 2008
    Location
    Dayton, Ohio
    Posts
    52

    Default Re: Google Video Sitemap

    Negative ghostrider.

    Once the video has been uploaded, it is converted to an FLV then placed into the flvideo directory. So, unless you have changed the directory it's 'flvideo'. I assume that is what you are asking me. I checked your site, here is your video source
    Code:
    http://vidzspot.com/flvideo/XXXXXXXXXXX.flv
    Let me know if you have anymore questions. Hope that helps :)

  6. #6
    Join Date
    Aug 2008
    Posts
    21

    Default Re: Google Video Sitemap

    you had the folder as flvvideo when it should be flvideo, and i removed the .flv at the end of the video link because it is added automatically though the file name.

    Thanks

  7. #7
    Join Date
    Mar 2008
    Location
    Dayton, Ohio
    Posts
    52

    Default Re: Google Video Sitemap

    Oddly, I didn't make those same mistakes in my own code for my site. Thanks for bringing them to my attention and the site. I hate to give anyone bad info. Thanks again!

Similar Threads

  1. Google Sitemap v2.7
    By RAMMSTEIN in forum vShare Modifications
    Replies: 57
    Last Post: 11-12-2010, 12:56 AM
  2. [addon] Video Sitemap for VShare
    By RAMMSTEIN in forum Template Modifications
    Replies: 2
    Last Post: 01-08-2009, 01:02 AM
  3. [addon] Google Sitemap Generator
    By RAMMSTEIN in forum Template Modifications
    Replies: 5
    Last Post: 11-07-2008, 04:25 AM
  4. [ADD ON] VShare Video Sitemap (FREE)
    By ramius in forum Template Modifications
    Replies: 8
    Last Post: 04-22-2008, 11:25 PM
  5. New Google video sitemap !!!
    By chadon in forum Feature Requests
    Replies: 2
    Last Post: 12-21-2007, 06:48 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •