Advertisement
Guest User

Script PHP - Sistema ouvir musicas pelo nome by Vaca_Marinha

a guest
May 1st, 2021
1,123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.73 KB | None | 0 0
  1. <?php
  2. /*
  3.  
  4.         Sistema de ouvir músicas pelo nome
  5.             by Vaca_Marinha
  6.  
  7.         (isso aqui é gambiarra pura)
  8.         Eu ia fazer com a API do soundcloud, porém não estão disponibilizando criar keys nela :v
  9.  
  10. */
  11. $nome = (isset($_GET['n'])) ? urlencode($_GET['n']) : exit("Digite um nome");
  12. $url = "http://site.mtabrasil.com.br/musicas/?s=".$nome;
  13. $content = file_get_contents($url);
  14. $first_step = explode( '<audio controls preload="none">' , $content );
  15. $links = array();
  16. foreach ($first_step as $key => $value) {
  17.     if($key > 0)
  18.     {
  19.         $second_step = explode("</audio>" , $value );
  20.         if (preg_match('/"([^"]+)"/', $second_step[0], $m)) {
  21.             array_push($links, $m[1]);  
  22.             break;
  23.         } else {
  24.         }
  25.     }
  26. }
  27. header("Location: ".$links[0]);
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement