Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- SONGS.PK GRABBER - Created by Techno
- Visit http://technoslab.blogspot.com for more
- Dependency -> GetID3
- */
- ini_set('time_limit','0');// Prevent script from timing out.
- ini_set('memory_limit','16M'); // Provide more memory to the script.
- $copy_to_server = true; // Should the song be copied server ?
- $dir = "./files/"; // The directory to which songs will be saved.
- $processtags = false; // Does the song's tags need to be edited before serving to user ? ( Will work only if file is copied to server. )
- // Alter the function process_tags() accordingly.
- $your_site_name = "(www.djurva.info.ru.com)"; // song name will include your site name.
- $max_files_to_store = 20;
- $arrow = "http://s2.postimage.org/2yqnqn010/arrow.png";
- /* function */
- function friendly_size($size,$round=2){
- $sizes=array(' Byts',' Kb',' Mb',' Gb',' Tb');
- $total=count($sizes)-1;
- for($i=0;$size>1024 && $i<$total;$i++){
- $size/=1024;
- }
- return round($size,$round).$sizes[$i];
- }
- function delete_files($dir){
- $h = opendir($dir);
- while($f = readdir($h)){
- if(is_file("$dir/$f")){
- unlink("$dir/$f");
- }
- }
- closedir($h);
- }
- function capitalize($var){
- return strtoupper(substr($var,0,1)).strtolower(substr($var,1));
- }
- function extract_movie_names($c,$char){
- $p = "@http://www.songs.pk/indian/(.+?)\.html@is";
- preg_match_all($p,$c,$m);
- $movies = array();
- foreach($m[1] as $mv){
- if(strtolower($char)==strtolower(substr($mv,0,1)))
- $movies[] = $mv;
- }
- sort($movies,SORT_STRING);
- return $movies;
- }
- function extract_songs($c){
- $p = "@<a href=\"(http://link.songs.pk/.+?)\">(.+?)</a>@is";
- preg_match_all($p,$c,$m);
- $songs = array();
- for($i=0;$i<count($m[1]);$i++){
- $songs[$m[1][$i]] = trim(strip_tags($m[2][$i]));
- }
- return $songs;
- }
- function extract_song_url($c){
- $h = get_headers($c);
- foreach($h as $v){
- if(substr($v,0,10)=="Location: ")
- return trim(str_replace("Location: ","",$v));
- }
- }
- function adv_get($url){
- return file_get_contents($url);
- }
- function process_tags($mp3_file,$data=""){
- if(!is_file($mp3_file))return false;
- $mp3_tagformat = 'UTF-8';
- include_once('getid3/getid3.php');
- $mp3_handler = new getID3;
- $mp3_handler->setOption(array('encoding'=>$mp3_tagformat));
- include_once('getid3/write.php');
- $mp3_writter = new getid3_writetags;
- $mp3_writter->filename = $mp3_file;
- $mp3_writter->tagformats = array('id3v1', 'id3v2.3');
- $mp3_writter->overwrite_tags = true;
- $mp3_writter->tag_encoding = $mp3_tagformat;
- $mp3_writter->remove_other_tags = false;
- /*
- // If you are here, you can uncomment this block to modify tags competely. ( not recommended) //
- $mp3_data['title'][] = $data['mp3_songname'];
- $mp3_data['artist'][] = $data['mp3_artist'];
- $mp3_data['album'][] = $data['mp3_album'];
- $mp3_data['year'][] = $data['mp3_year'];
- $mp3_data['genre'][] = $data['mp3_genre'];
- $mp3_data['comment'][] = $data['mp3_comment'];
- $mp3_data['attached_picture'][0]['data'] = file_get_contents($data['mp3_image']['path']);
- $mp3_data['attached_picture'][0]['picturetypeid'] = $data['mp3_image']['type'];
- $mp3_data['attached_picture'][0]['description'] = $data['mp3_image']['name'];
- $mp3_data['attached_picture'][0]['mime'] = $data['mp3_image']['type'];
- */
- // Comment / Remove the lines below .
- $mp3_data['comment'][] = $data['mp3_comment'];
- $mp3_writter->tag_data = $mp3_data;
- $mp3_writter->WriteTags();
- }
- ?>
- <html>
- <head>
- <title>Download all Bollywood songs</title>
- <style type="text/css">
- body{background:rgb(185,185,185);}
- a:link,a:visited,a:hover{font:inherit;color:inherit;text-decoration:none;}
- a:hover{color:rgb(0,0,150);}
- .header{padding:5px;margin:5px;font:bold 20px cursive;color:rgb(50,150,250);border:1px dotted rgb(50,50,150);background:rgb(255,255,255);}
- .list{font:bold 15px cursive;padding:10px;margin:5px;border:1px dotted rgb(50,50,150);background:rgb(255,255,255) left center no-repeat;}
- div:hover{background-color:rgb(255,255,155);cursor:;}
- .list *:hover{color:rgb(150,150,250);}
- img{border:0px;}
- </style>
- </head>
- <body>
- <?php
- //$alpha = array("latest","numeric","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z");
- $alpha = array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z");
- if(isset($_GET['song'])){
- $song = base64_decode($_GET['song']);
- $song_url = extract_song_url($song);
- if(filter_var($song_url,FILTER_VALIDATE_URL)){
- if($copy_to_server){
- $song_name = basename($song_url);
- $song_name = str_replace("(www.songs.pk)","$your_site_name",$song_name);
- $song_name = $dir.$song_name;
- $num_files = count(scandir($dir));
- $num_files -= 2;
- if($num_files>$max_files_to_store){
- delete_files($dir);
- }
- if(!is_file($song_name)){
- $iscopied = copy($song_url,$song_name);
- if(iscopied){
- if($processtags){
- process_tags($song_name);
- }
- echo"<div class='list'><a href='$song_name'><div> <img src='$arrow' alt='»' title='»' align='middle' /> Click here to download : ".capitalize(basename($song_name))."</div></a> ( ".friendly_size(filesize($song_name)).")</div>";
- }
- else{
- echo"<div class='msg'> <img src='$arrow' alt='»' title='»' align='middle' /> Try downloading again ...</div>";
- }
- }
- else{
- echo"<div class='list'><a href='$song_name'><div> <img src='$arrow' alt='»' title='»' align='middle' /> Click here to download : ".capitalize(basename($song_name))."</div></a> ( ".friendly_size(filesize($song_name)).")</div>";
- }
- }
- else{
- echo"<div class='list'><a href='$song_url'><div> <img src='$arrow' alt='»' title='»' align='middle' /> Click here to download : ".capitalize(basename(str_replace("(www.songs.pk)","",$song_url)))."</div></a></div>";
- }
- }
- else{
- echo"<div class='msg'><div> <img src='$arrow' alt='»' title='»' align='middle' /> Try downloading again ...<div></div>";
- }
- }
- else{
- if(isset($_GET['movie'])){
- $base = "http://www.songs.pk/indian/";
- $movie = $_GET['movie'];
- $murl = $base.$movie.".html";
- $data = adv_get($murl);
- $songs = extract_songs($data);
- echo"<h3 class='header'>Songs of the movie '".capitalize($movie)."'</h3>";
- foreach($songs as $song => $name){
- echo"<div class='list'><a href='?song=".base64_encode($song)."'><div> <img src='$arrow' alt='»' title='»' align='middle' /> $name</div></a></div>";
- }
- }
- else{
- if(isset($_GET['char'])){
- $char = strtolower($_GET['char']);
- if(in_array($char,$alpha)){
- if($char=='latest') $data = adv_get("http://www.songs.pk/");
- else $data = adv_get("http://www.songs.pk/{$char}_list.html");
- $movies = extract_movie_names($data,$char);
- echo"<h3 class='header'>List of movies starting with '".capitalize($char)."'</h3>";
- foreach($movies as $movie){
- echo"<div class='list'><a href='?movie=$movie'><div> <img src='$arrow' alt='»' title='»' align='middle' /> ".capitalize($movie)."</div></a></div>";
- }
- }
- else{
- echo"<div class='msg'>The character '$char' is Invalid</div>";
- }
- }
- else{
- echo"<h3 class='header'>Movie name starts with ?</h3>";
- for($i=0;$i<26;$i++){
- echo"<div class='list'><a href='?char=$alpha[$i]' title='Movie starts with $alpha[$i]' class='button round'><div> <img src='$arrow' alt='»' title='»' align='middle' /> ".capitalize($alpha[$i])."</div></a> </div>";
- }
- }
- }
- }
- ?>
- <div class='list'><a href='index.php'><div>Back to homepage</div></a></div>
- </body>
- </html>
Add Comment
Please, Sign In to add comment