Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- error_reporting(E_ALL);
- $content=file_get_contents("http://www.watchdub.com/english-dubbed/bleach");
- $connection=mysqli_connect("localhost","root","","a000b_13409064_Entertain");
- if (mysqli_connect_errno($connection))
- {
- echo "Failed to connect to MySQL: " . mysqli_connect_error();
- }
- else{
- echo "Connected to database successfully!";
- }
- $listUnfilter=GetBetween($content,"<p><a ","</span></p>");
- $listSemifilter=explode("<br />",$listUnfilter);
- for($x=0;$x<(count($listSemifilter)-2);$x++){
- $listFiltered[$x]['url']=GetBetween($listSemifilter[$x],'href="','">');
- $listFiltered[$x]['episode']=GetBetween($listSemifilter[$x],"Episode "," | English");
- $listFiltered[$x]['tags']=GetBetween($listSemifilter[$x],'<meta name="keywords" content="',' />');
- //works
- $embedcontent=file_get_contents($listFiltered[$x]['url']);
- $embedcontent=GetBetween($embedcontent,"<DIV STYLE='float: left; clear:both;'></DIV>","</DIV>
- </DIV>
- <DIV STYLE='clear: both;'></DIV>");
- $replace[0]="<DIV ID = 'tabcontent_post_Video Mirror 1' CLASS='tab_content' STYLE='display: block;'>";
- $replace[1]="<DIV ID = 'tabcontent_post_Video Mirror 2' CLASS='tab_content' STYLE='display: none;'>";
- $replace[2]="<DIV ID = 'tabcontent_post_Video Mirror 3' CLASS='tab_content' STYLE='display: none;'>";
- $replace[3]="<DIV ID = 'tabcontent_post_Video Mirror 4' CLASS='tab_content' STYLE='display: none;'>";
- $replace[4]="<DIV STYLE='clear: both;'></DIV>";
- $replace[5]="<DIV ID = 'tabcontent_post_Video Mirror 4 Part 1' CLASS='tab_content' STYLE='display: none;'>";
- $replace[6]="<DIV ID = 'tabcontent_post_Video Mirror 4 Part 2' CLASS='tab_content' STYLE='display: none;'>";
- $replace[7]="<DIV ID = 'tabcontent_post_Video Mirror 4 Part 3' CLASS='tab_content' STYLE='display: none;'>";
- $replace[8]="<DIV ID = 'tabcontent_post_Video Mirror 5' CLASS='tab_content' STYLE='display: none;'>";
- $embedcontent=str_replace($replace,"",$embedcontent);
- $listFiltered[$x]['embed']=explode("</DIV>",$embedcontent);
- for($al=0;$al<(count($listFiltered[$x]['embed'])-2);$al++)
- {
- insertAnime("bleach",$x+1,$al+1,"dubbed",$listFiltered[$x]['embed'][$al],$listFiltered[$x]['tags']);
- }}
- echo "Grabbing Complete";
- function insertAnime($name,$number,$mirror,$type,$embed,$tags){
- global $connection;
- mysqli_query($connection,"INSERT INTO Anime(Series,Number,Mirror,Type,Embed,Tags) VALUES('$name',$number, $mirror, '$type', '$embed', '$tags')")or die(mysqli_error($connection));
- }
- function GetBetween($content,$start,$end){
- $r = explode($start, $content);
- if (isset($r[1])){
- $r = explode($end,$r[1].'');
- return $r[0];
- }
- return '';
- }
- mysqli_close($connection);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment