Venomshq

Anime Grabber

Jul 18th, 2013
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.63 KB | None | 0 0
  1. <?php
  2. error_reporting(E_ALL);
  3. $content=file_get_contents("http://www.watchdub.com/english-dubbed/bleach");
  4. $connection=mysqli_connect("localhost","root","","a000b_13409064_Entertain");
  5. if (mysqli_connect_errno($connection))
  6.   {
  7.   echo "Failed to connect to MySQL: " . mysqli_connect_error();
  8.   }
  9. else{
  10. echo "Connected to database successfully!";
  11. }
  12.  
  13. $listUnfilter=GetBetween($content,"<p><a ","</span></p>");
  14. $listSemifilter=explode("<br />",$listUnfilter);
  15. for($x=0;$x<(count($listSemifilter)-2);$x++){
  16. $listFiltered[$x]['url']=GetBetween($listSemifilter[$x],'href="','">');
  17. $listFiltered[$x]['episode']=GetBetween($listSemifilter[$x],"Episode "," | English");
  18. $listFiltered[$x]['tags']=GetBetween($listSemifilter[$x],'<meta name="keywords" content="',' />');
  19. //works
  20. $embedcontent=file_get_contents($listFiltered[$x]['url']);
  21. $embedcontent=GetBetween($embedcontent,"<DIV STYLE='float: left; clear:both;'></DIV>","</DIV>
  22. </DIV>
  23. <DIV STYLE='clear: both;'></DIV>");
  24. $replace[0]="<DIV ID = 'tabcontent_post_Video Mirror 1' CLASS='tab_content' STYLE='display: block;'>";
  25. $replace[1]="<DIV ID = 'tabcontent_post_Video Mirror 2' CLASS='tab_content' STYLE='display: none;'>";
  26. $replace[2]="<DIV ID = 'tabcontent_post_Video Mirror 3' CLASS='tab_content' STYLE='display: none;'>";
  27. $replace[3]="<DIV ID = 'tabcontent_post_Video Mirror 4' CLASS='tab_content' STYLE='display: none;'>";
  28. $replace[4]="<DIV STYLE='clear: both;'></DIV>";
  29. $replace[5]="<DIV ID = 'tabcontent_post_Video Mirror 4 Part 1' CLASS='tab_content' STYLE='display: none;'>";
  30. $replace[6]="<DIV ID = 'tabcontent_post_Video Mirror 4 Part 2' CLASS='tab_content' STYLE='display: none;'>";
  31. $replace[7]="<DIV ID = 'tabcontent_post_Video Mirror 4 Part 3' CLASS='tab_content' STYLE='display: none;'>";
  32. $replace[8]="<DIV ID = 'tabcontent_post_Video Mirror 5' CLASS='tab_content' STYLE='display: none;'>";
  33.  
  34. $embedcontent=str_replace($replace,"",$embedcontent);
  35. $listFiltered[$x]['embed']=explode("</DIV>",$embedcontent);
  36. for($al=0;$al<(count($listFiltered[$x]['embed'])-2);$al++)
  37. {
  38. insertAnime("bleach",$x+1,$al+1,"dubbed",$listFiltered[$x]['embed'][$al],$listFiltered[$x]['tags']);
  39. }}
  40. echo "Grabbing Complete";
  41.  
  42. function insertAnime($name,$number,$mirror,$type,$embed,$tags){
  43. global $connection;
  44. mysqli_query($connection,"INSERT INTO Anime(Series,Number,Mirror,Type,Embed,Tags) VALUES('$name',$number, $mirror, '$type', '$embed', '$tags')")or die(mysqli_error($connection));
  45. }
  46.  
  47. function GetBetween($content,$start,$end){
  48.     $r = explode($start, $content);
  49.     if (isset($r[1])){
  50.         $r = explode($end,$r[1].'');
  51.         return $r[0];
  52.     }
  53.     return '';
  54. }
  55. mysqli_close($connection);
  56. ?>
Advertisement
Add Comment
Please, Sign In to add comment