Bravo List
Register
Go Back   > Bravo List > P2P > Forum > Community Cafe
Reply
  #1  
Old 18th September 2014, 08:56
firefly007's Avatar
firefly007 firefly007 is offline
SUPPORT GURU
 
Join Date: Jun 2010
P2P
Posts: 721
Default TVRAGE AND TVDB SCRAPE SERIES DATA USING PHP
This is a little project I worked on for my site, I thought I would share it!!


Code:
                 
   <?php
 
    /////////////////////////////////////////TVRAGE AND TVDB FIND SERIES DATA////////////////////////////////////////
   ////////////////////////////////////////////////////2014-09-18///////////////////////////////////////////////////
  /////////////////////////////////////////////////CREATED BY FIREFLY//////////////////////////////////////////////
 ///////////////////////////////////////////////dan.oak44@gmail.com///////////////////////////////////////////////
 
$TVRAGE_KEY = ' ';    //Create an account on TVRAGE to get your key.
$TVDB_KEY   = ' ';   //Create an account on TVDB to get your key.



class TV
{
  
 function TVRAGE($id,$sw){
global $TVRAGE_KEY;     
$Url1 = 'http://services.tvrage.com/myfeeds/showinfo.php?key='.$TVRAGE_KEY.'&sid='.$id;
$feed1= file_get_contents($Url1); 
$VAR = new SimpleXmlElement($feed1);

$elem_1a  = $VAR -> xpath('showid');           $ela  = $elem_1a[0];
$elem_2b  = $VAR -> xpath('showname');         $elb  = $elem_2b[0];
$elem_2c  = $VAR -> xpath('seasons');          $elc  = $elem_2c[0];
$elem_2d  = $VAR -> xpath('image');            $eld  = $elem_2d[0];
$elem_2e  = $VAR -> xpath('started');          $ele  = $elem_2e[0];
$elem_2f  = $VAR -> xpath('startdate');        $elf  = $elem_2f[0];
$elem_2g  = $VAR -> xpath('ended');            $elg  = $elem_2g[0];
$elem_2h  = $VAR -> xpath('runtime');          $elh  = $elem_2h[0];
$elem_2i  = $VAR -> xpath('airtime');          $eli  = $elem_2i[0];
$elem_2ja  = $VAR -> xpath('network');          $elja  = $elem_2aj[0];


$Url2 = 'http://services.tvrage.com/myfeeds/episode_list.php?key='.$TVRAGE_KEY.'&sid='.$id;
$feed2=    file_get_contents($Url2);    
$var2 = new SimpleXmlElement($feed2);
$elem_2a  = $var2 -> xpath('Episodelist/Season/episode/rating');  $elk  = $elem_2a[0];

switch ($sw) {
  case "rageID":       $out = $ela;break;
  case "name":         $out = $elb;break;
  case "seasons":      $out = $elc;break;
  case "image":        $out = $eld;break;
  case "started":      $out = $ele;break;
  case "startdate":    $out = $elf;break;
  case "ended":        $out = $elg;break;
  case "runtime":      $out = $elh;break;
  case "airtime":      $out = $eli;break;
  case "network":      $out = $elja;break;
  case "rate":         $out = $elk;break;
}
return $out;
}


function TVDB($name,$sw){
global $TVDB_KEY; 
$Url = 'http://thetvdb.com/api/GetSeries.php?seriesname=' . str_replace(" ", "%20", $name);
$feed= file_get_contents($Url);
$var1 = new SimpleXmlElement($feed);

$tvdb_id    = $var1 -> xpath('Series/seriesid');
$tvdb_name  = $var1 -> xpath('Series/SeriesName');
$first      = $var1 -> xpath('Series/FirstAired');
$net        = $var1 -> xpath('Series/Network');
$imdb       = $var1 -> xpath('Series/IMDB_ID');
$zap2it_id  = $var1 -> xpath('Series/zap2it_id');
$tvdb_ban   = $var1 -> xpath('Series/banner');
$tvdb_ove   = $var1 -> xpath('Series/Overview');

$id         = $tvdb_id[0];
$name       = $tvdb_name[0];
$firstair   = $first[0];
$network    = $net[0];
$imdbID     = $imdb[0];
$zap        = $zap2it_id[0];
$ban        = $tvdb_ban[0];
$over       = $tvdb_ove[0];

$Url1 = 'http://www.thetvdb.com/api/'.$TVDB_KEY.'/series/'.$id.'/banners.xml';
$feed1= file_get_contents($Url1);
$var1 = new SimpleXmlElement($feed1);
$art  = $var1 -> xpath('Banner/BannerPath');
$vig  = $var1 -> xpath('Banner/VignettePath');
$fan       = $art[0];
$vignette  = $vig[0];

switch ($sw) {
    
  case "id"    :$out = $id;break;
  case "name"  :$out = $name;break;
  case "air"   :$out = $firstair;break;
  case "net"   :$out = $network;break;
  case "imdb"  :$out = $imdbID;break;
  case "zap"   :$out = $zap;break;
  case "ban"   :$out = 'http://thetvdb.com/banners/_cache/'.$ban;break;
  case "desc"  :$out = $over;break;
  case "fan"   :$out = 'http://thetvdb.com/banners/'.$fan;break;
  case "vig"   :$out = 'http://thetvdb.com/banners/'.$vignette;break;
  default      :$out = $name;
}

return $out;
}

}


$TV = new TV;

print $TV->TVRAGE("6313","rageID");
print '<br>';
print $TV->TVRAGE("6313","name");
print '<br>';
print $TV->TVRAGE("6313","seasons");
print '<br>';
print '<img src="'.$TV->TVRAGE("6313","image").'">';
print '<br>';
print $TV->TVRAGE("6313","started");
print '<br>';
print $TV->TVRAGE("6313","startdate");
print '<br>';
print $TV->TVRAGE("6313","ended");
print '<br>';
print $TV->TVRAGE("6313","runtime");
print '<br>';
print $TV->TVRAGE("6313","airtime");
print '<br>';
print $TV->TVRAGE("6313","network");
print '<br>';
print $TV->TVRAGE("6313","rate");
print '<br>';
print '<img src="'.$TV->TVDB("The X Factor","vig").'">';
print '<br>';
print $TV->TVDB("Game Of Thrones","id");
print '<br>';
print $TV->TVDB("Game Of Thrones","name");
print '<br>';
print $TV->TVDB("Game Of Thrones","air");
print '<br>';
print $TV->TVDB("Game Of Thrones","net");
print '<br>';
print $TV->TVDB("Game Of Thrones","imdb");
print '<br>';
print $TV->TVDB("Game Of Thrones","zap");
print '<br>';
print $TV->TVDB("Game Of Thrones","desc");
print '<br>';
print '<img src="'.$TV->TVDB("Game Of Thrones","ban").'">';
print '<br>';
print '<img src="'.$TV->TVDB("Game Of Thrones","fan").'">';
print '<br>';
You can download the source to if you like.


You will need to add a new form to your torrent upload,edit form for tv name for TVDB and a new form for TVRAGE id, you will also need to create two new rows in your mysql torrent table.

Then you will do the following..

TVRAGE EXAMPLE
Code:
print $TV->TVRAGE($row["rageID"],"seasons");
TVDB EXAMPLE
Code:
print $TV->TVDB($row["TVDB_name"],"air");
Remember! That you will need to add the two new rows to your main query!

If there are any problems let me know!!!
Attached Files
File Type: php series_class.php (5.0 KB, 24 views)
__________________




Please Support Majority Report


You can contact me on Skype live:phesadent.elect but please let me know first.


If you are ever need me desperately then please email me at dan.oak44@gmail.com and I will contact u within a week.


Due to free time I'm able to help interested member's with their tracker.

Please Note!
Depending on your requests I will charge you for my assistance for Tracker installs and mods.
All my mods are custom and prices will very depending on the request.
I'm able to install any tracker and mods including themes.

Please PM me


Last edited by firefly007; 18th September 2014 at 11:27.
Reply With Quote
The Following 3 Users Say Thank You to firefly007 For This Useful Post:
Fynnon (18th September 2014), lafouine022 (23rd September 2014), MaVerick88 (18th September 2014)
  #2  
Old 18th September 2014, 09:29
DND DND is offline
VIP
 
Join Date: Dec 2008
Posts: 1,241
Default
thank you for sharing.
__________________
Need HELP!? I can install:

  1. Server/VPS (Debian,CentOS,Ubuntu,Fedora, FreeBSD) Optimization and ... + Modules
  2. Webserver Windows/Linux (Apache/Lighttpd/Nginx/Mysql/PhpMyAdmin/SSL) Optimization and ... + Modules
  3. Seedbox Windows/Linux (uTorrent,rTorrent,libTorrent,ruTorrent) + Modules
  4. Multiple source code engines
  5. Linux Server Administration (security, cryptography/encryption, proxy, load balancer, custom ddos firewall)
Reply With Quote
Reply

Tags
data , php , scrape , series , tvdb , tvrage

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT +2. The time now is 23:35. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.