07-13-2008, 11:44 PM
|
#1 (permalink)
|
|
Super Moderator
Join Date: Sep 2007
Location: Near you.
Posts: 791
Thanks: 241
|
update on my youtube rss grabber need help. [NO FLAME]
please don't flame me for the code i know it's messy but i coded out my ass so some things just came on the page :P
i will fix it later so please try to just focus on helping me
thank you in advance!
PHP Code:
<style type="text/css">
body {
margin:0px 0px 0px 0px;
background: #000000;
padding: 0px;
color: #00FF00;
}
ul {
list-style-type: none;
}
A:hover {text-decoration: underline overline; color: red;}
#videotumbnail {
text-decoration:none;
width: 200px;
height: 140px;
background: #F1F1F1;
color: #FF0000;
padding: 0px;
margin: 0px;
}
#videotitle {
text-decoration:none;
width: 200px;
hight: 140px;
background: #F1F1F1;
color: #00FF00;
padding: 0px;
border-left: 2px solid #FF7744;
border-right: 2px solid #FF7744;
border-down: 2px solid #FF7744;
border-up: 2px solid #FF7744;
margin: 0px;
}
#all {
text-decoration:none;
width: 200px;
hight: 140px;
background: #FFFFFF;
color: #00FF00;
padding: 0px;
border-left: 2px solid #FF7744;
border-right: 2px solid #FF7744;
border-down: 2px solid #FF7744;
border-up: 2px solid #FF7744;
margin: 0px;
}
.p {
text-decoration:none;
width: 200px;
hight: 140px;
background: #FFFFFF;
color: #00FF00;
padding: 0px;
border-left: 2px solid #FF7744;
border-right: 2px solid #FF7744;
border-down: 2px solid #FF7744;
border-up: 2px solid #FF7744;
margin: 0px;
}
#videodescription {
text-decoration:none;
width: 200px;
hight: 140px;
background: #FFFFFF;
color: #00FF00;
padding: 0px;
margin: 0px;
float:right;
}
</style>
<?php
//Codefreek Production
//www.talkphp.com
//BETA 0.1 RSS Grabber From Youtube
//Copyright 08 - 09 by codefreek
//if you like please pm me and say thank you and i will continue doing more free scripts.
//only use when needed!
//ini_set("user_agent","Internet Explorer");
//Edit here for your rss link
$location = "http://youtube.com/rss/global/top_rated.rss";
$contents = file_get_contents($location);
$xml = new SimpleXMLElement($contents);
$limiter = 0;
$limit = 0; // use 0 for no limit
$desclimit = 120; // use 0 for no limit
$i = 0;
$str = "";
$img = preg_replace('/^.*?(<img [^>]+>).*$/is','\1',$item->description); // Uncomment if you need full <img /> tag
$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 "<ul>";
print '<div id="all">';
foreach($xml->channel->item as $item) {
echo "<li>";
$linkarray = explode("=",$item->link);
print '<div id="videotitle">';
echo "<a href='".$item->link."' title=''>";
echo "$item->title";
echo "</br>";
echo "</br>";
$desclimit = ($desclimit != 0 && $desclimit < 3 ? $desclimit +3 : $desclimit); // Sanity check
print '<div id="videotumbnail">';
echo "<img src=\"http://s2.ytimg.com/vi/".$linkarray[1]."/default.jpg\" title=\"$item->title.\" />";
echo "</a>";
print '<div id="videodescription">';
echo "<p>$item->description</p>";
$str .= "<p>". ((($desclimit != 0) && (strlen($tmp_desc) > $desclimit)) ? substr($tmp_desc,0,$desclimit-3)."..." : $tmp_desc) ."</p>";
$str .= $imgsrc;
if ($limit != 0 && $i == $limit)
break;
echo "</li>";
$limiter++;
// here you can change the 10 to the limit
//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>";
print "</div>";
print "</div>";
print "</div>";
print "</div>";
?>
<b><center>Youtube RSS Grabber 0.1 BETA - By Codefreek</center></b>
</br>
<center><b>NEWS</b>
<ol>
</br>
<p>now you get The video Title when you hover over a tumbnail.
more small changes will be made.</p></ol></center>
</br>
<center><a href="http://www.td4l.org"><p>This site is hosted by: Td4l.org</p></a></center>
<?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>";
?>
|
|
|
|