artist.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. require "modules/querypath/src/qp.php";
  3. $document = htmlqp(file_get_contents("https://" . urlencode($_GET["name"]) . ".bandcamp.com"));
  4. $title = $document->find("#band-name-location .title")->text();
  5. ?>
  6. <?php include "elements/header.php" ?>
  7. <?php
  8. echo "<div class=results>";
  9. foreach ($document->find("#music-grid li") as $release) {
  10. $title = preg_split("/\n[\n\s]+/", trim($release->find(".title")->text()));
  11. $image = $release->find("img");
  12. if ($image->hasAttr("data-original"))
  13. $image = $image->attr("data-original");
  14. else
  15. $image = $image->attr("src");
  16. $image = "image.php?file=" . basename($image);
  17. echo "<a href=https://" . urlencode($_GET["name"]) . ".bandcamp.com" . $release->find("a")->attr("href") . ">";
  18. echo "<div>";
  19. echo "<img src=" . $image . ">";
  20. echo "<p>";
  21. echo htmlspecialchars($title[0]);
  22. if (isset($title[1])) {
  23. echo "<br>";
  24. echo "<small>";
  25. echo "by " . htmlspecialchars($title[1]);
  26. echo "</small>";
  27. };
  28. echo "</p>";
  29. echo "</div>";
  30. echo "</a>";
  31. };
  32. echo "</div>";
  33. ?>
  34. <?php include "elements/footer.php" ?>