| codefreek |
07-19-2008 02:20 AM |
Stuck on a bug [Youtube RSS Grabber] - Credit to person!
(Alpha 0.1.3)
- **Hello everyone, i am working on a update of Youtube RSS Grabber Alpha 0.1.3
**stuck on a bug fix if some one can help me you will be greatly credited
**on the release of the script update.
so what the problem is:
#Note: No Error is given;
I am trying to get the Video Thing open in a box - Like, Lightbox and other Box Type things. but for the record i use vPIP. And here is a link for it to get people up to speed on what it is:
#Note: The Problem is that it wont open in a box like its suppose to.
::This is the Html set of my page::
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>::Youtube RSS GRABBER::</title>
<meta name="author" content="Codefreek">
<meta name="description" content="youtube rss video grabber">
<meta name="keywords" content="rss">
<link rel="stylesheet" href="css/pageset.css" type="text/css">
<script src="http://localhost/youtube_rss/testarea/vPIP/vpip.js" type="text/javascript"></script>
<style type="text/css" media="all">@import "http://localhost/youtube_rss/testarea/vPIP/vPIPBox.css";</style>
<script src="http://localhost/youtube_rss/testarea/vPIP/jquery.js" type="text/javascript"></script>
<script src="http://localhost/youtube_rss/testarea/vPIP/vpipit.js" type="text/javascript"></script>
</head>
::and this is the rest::
PHP Code:
<img src="./pic_youtubelogo_123x63.gif"/> <?php /* Alpha 0.1.3 RSS Grabber From Youtube Copyright 08 - 09 by codefreek */ //some sites don't let you get rss feeds without broweser so this will help use uncomment the iniset //ini_set("user_agent","Internet Explorer");
/* Edit here for your rss link */ $location = "http://youtube.com/rss/global/top_rated.rss"; /* get_contents */ $contents = file_get_contents($location); /* xml-element */ $xml = new SimpleXMLElement($contents); /* let this be on 0 */ $limiter = 0; /* change this for the limit you want on description */ $desclimit = 120; // use 0 for no limit echo "<ul>";
foreach($xml->channel->item as $item) {
/* pregreplace is to cut out stuff we don't want or at better terms change into what we want */
$img = preg_replace('/^.*?(<img [^>]+>).*$/is','\1',$item->description); $imgsrc = preg_replace('/^.*?(<img [^>]*?src="([^"]+)"[^>]*>).*$/is','\2',$item->description); $tmp_desc = preg_replace('#.*?(<p>.+?</p>).*#is','\1',$item->description); $tmp_desc = trim(preg_replace('#(<[^>]+>|http://\S+|www\.\S+\.\S{2,3}\S+)#','',$tmp_desc));
echo "<li>";
/* put the string in to 2 arrays */
$linkarray = explode("=",$item->link);
echo "</br>";
echo "</br>";
/* Sanity check */
$desclimit = ($desclimit != 0 && $desclimit < 3 ? $desclimit +3 : $desclimit);
/* output header link and image and description and video */
if (isset($_POST['video'])) { echo '<div class="hVlog" style="text-align: center"> <a href="http://www.youtube.com/v/'.$linkarray[1].'" class="hVlogTarget" type="application/x-shockwave-flash" onclick="vPIPPlay(this, null, null, \'active=true, caption=Youth Wasted\'); return false;"> <img src="http://s2.ytimg.com/vi/'.$linkarray[1].'" /></a> <br /> <a href="http://www.youtube.com/v/'.$linkarray[1].'" type="application/x-shockwave-flash" onclick="vPIPPlay(this, null, null, null); return false;"> Video </div>'; } else {
echo '<a href="',$item->link,'"><img src="http://s2.ytimg.com/vi/',$linkarray[1],'/default.jpg" title="'.$item->title.'" style="float: left;" /></a>'; }
//description limiter & link
echo '<h2><a href="',$item->link,'">',$item->title,'</a> <p style="clear: both;">'.((($desclimit != 0) && (strlen($tmp_desc) > $desclimit)) ? substr($tmp_desc,0,$desclimit-3)."..." : $tmp_desc).'</p></h2>'; echo "</li>";
$limiter++;
////////////////////////////////////////////////////// //Change the 10 or the 5 or the 2 to what you want/// ////////////////////////////////////////////////////
if (isset($_POST['defualt'])) { if ($limiter == 10) break; }
if (isset($_POST['subfive'])) { if ($limiter == 5) break; } else { if (isset($_POST['subten'])) {
if ($limiter == 2) break; } }
}
echo "</ul>";
?>
<b><center>Youtube RSS Grabber 0.1.3 Alpha - By Codefreek</center></b>
<?php echo "<form action='youtube_rss_grabber.php' name='rss' method='post'> <input type='submit' name='subten' value='subten'> <input type='submit' name='subfive' value='subfive'> <input type='submit' name='defualt' value='defualt'> </form>"; echo "<form action='youtube_rss_grabber.php' name='rss' method='post'> <input type='submit' name='video' value='video'> </form>"; ?>
- Once more the person who helps me on this is truly a life saver and is in advanced thanked!
-Thank you in advance-
##Codefreek##
|