-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathartists.php
More file actions
118 lines (75 loc) · 3.94 KB
/
Copy pathartists.php
File metadata and controls
118 lines (75 loc) · 3.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?php
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
error_reporting(E_ALL);
include('lib/simplehtmldom/simple_html_dom.php');
require_once('global.php');
require_once('topbar.php');
include('misc/theme_ctrl.php');
?>
<html class="<?php echo $sitetheme ?>">
<head>
</head>
<body class="<?php echo $sitetheme ?>">
<link rel="stylesheet" href="style.css">
<div class="page <?php echo $sitetheme ?>">
<?php
if (isset($_GET['q']) && $_GET['q'] != '') {
echo '<title>'.trim($_GET['q']).' | Qobuz-DL</title>';
echo '<span class="title-results '.$sitetheme.'">Artist results for <b>"'.$_GET['q'].'"</b></span><hr size=1 color="#c6c6c6">';
echo '<div>';
$ch = curl_init();
$reqURL = 'https://www.qobuz.com/us-en/search/artists/'. $_GET['q'];
if (isset($_GET['page']) && is_numeric($_GET['page'])) {
$reqURL = $reqURL . '/' . 'page/' . $_GET['page'];
}
curl_setopt($ch, CURLOPT_URL, $reqURL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$dom = new simple_html_dom();
$dom->load($response);
echo '<table class="artists" style="width: 100%;">';
$artistItem = $dom->find('.FollowingCard');
foreach ($artistItem as $artist) {
$url = $artist->find('.CoverModelOverlay');
$img = $artist->find('.CoverModelImage');
if ($img[0] && $img[0]->src == '/assets-static/img/common/default_artist.svg') {
$img[0]->src = 'img/misc/artist128.png';
}
if (isset($url[0]) && isset($img[0])) {
echo '<tr class="artist-result '.$sitetheme.'">
<td style="width:0"><img class="pic '.$sitetheme.'" src="'.$img[0]->src.'"></td>
<td style="padding-left: 15px"';
echo '<span>
<a href="catalog.php?view-as=artist&url='.urlencode($url[0]->href).'">'.$artist->getAttribute('title').'</a>
</span>';
echo '</td></tr>';
}
}
echo '</table>';
echo '</div>';
}
echo '<form class="nav-buttons" method="GET" action="artists.php">';
$query = '';
$type = 'search';
$page = 1;
if (isset($_GET['q'])) {
$query = $_GET['q'];
}
echo '<input name="type" type="hidden" value="'.$type.'"></input>';
echo '<input name="q" type="hidden" value="'.$query.'"></input>';
if (isset($_GET['page'])) {
$page = $_GET['page'];
}
$page_nxt = $page + 1;
$page_prev = $page - 1;
if ($page > 1) {
echo '<button onclick="loadingDialog(\'\')" class="btn1" name="page" type="submit" value="'.$page_prev.'">← Prev page</button>';
}
echo '<button onclick="loadingDialog(\'\')" class="btn1" name="page" type="submit" value="'.$page_nxt.'">Next page →</button>';
echo '</form>';
?>
</div>
</body>
</html>