@@ -44,16 +44,148 @@ public function logIn($username, $password) {
44
44
}
45
45
46
46
public function search ($ field = "track " , $ query = NULL ) {
47
- return json_decode ($ this ->sendRequest ("search/ " . $ field . " s " , ["sessionId " => $ this ->sessionId , "countryCode " => $ this ->countryCode , "limit " => 999 , "query " => $ query ]), true )["items " ];
47
+ return json_decode ($ this ->sendRequest ("search/ " . $ field , ["sessionId " => $ this ->sessionId , "countryCode " => $ this ->countryCode , "limit " => 999 , "query " => $ query ]), true )["items " ];
48
48
}
49
49
50
+ public function getTrackUrl ($ TrackId , $ Quality = "HIGH " ) {
51
+ return $ this ->sendRequest ("tracks/ " . $ TrackId . "/streamUrl " , ["sessionId " => $ this ->sessionId , "countryCode " => $ this ->countryCode , "soundQuality " => $ Quality ]);
52
+ }
53
+
54
+ public function getVideoUrl ($ VideoId , $ Quality = "MEDIUM " ) {
55
+ return $ this ->sendRequest ("videos/ " . $ VideoId . "/urlpostpaywall " , ["sessionId " => $ this ->sessionId , "countryCode " => $ this ->countryCode , "urlusagemode " => "STREAM " , "assetpresentation " => "FULL " , "videoquality " => $ Quality ]);
56
+ }
57
+
58
+ public function getVideo ($ VideoId ) {
59
+ return $ this ->sendRequest ("videos/ " . $ VideoId , ["sessionId " => $ this ->sessionId , "countryCode " => $ this ->countryCode ]);
60
+ }
61
+
62
+ public function getTrack ($ TrackId ) {
63
+ return $ this ->sendRequest ("tracks/ " . $ TrackId , ["sessionId " => $ this ->sessionId , "countryCode " => $ this ->countryCode ]);
64
+ }
65
+
66
+ public function getTrackRadio ($ TrackId , $ Limit = 100 ) {
67
+ return $ this ->sendRequest ('tracks/ ' . $ TrackId . '/radio ' , ["sessionId " => $ this ->sessionId , "countryCode " => $ this ->countryCode , "limit " => $ Limit ]);
68
+ }
69
+
70
+ public function getGenres () {
71
+ return $ this ->sendRequest ('genres ' , ["sessionId " => $ this ->sessionId , "countryCode " => $ this ->countryCode ]);
72
+ }
73
+
74
+ public function getGenreItems ($ GenreId , $ ContentType ) {
75
+ return $ this ->sendRequest ('genres/ ' . $ GenreId . '/ ' . $ ContentType , ["sessionId " => $ this ->sessionId , "countryCode " => $ this ->countryCode ]);
76
+ }
77
+
78
+ public function getMoods () {
79
+ return $ this ->sendRequest ('moods ' , ["sessionId " => $ this ->sessionId , "countryCode " => $ this ->countryCode ]);
80
+ }
81
+
82
+ public function getMoodPlaylist ($ MoodId ) {
83
+ return $ this ->sendRequest ('moods/ ' . $ MoodId . '/playlists ' , ["sessionId " => $ this ->sessionId , "countryCode " => $ this ->countryCode ]);
84
+ }
85
+
86
+ public function getFeatured () {
87
+ return json_decode ($ this ->sendRequest ('promotions ' , ["sessionId " => $ this ->sessionId , "countryCode " => $ this ->countryCode ]), true )["items " ];
88
+ }
89
+
90
+ public function getFeaturedItems ($ Group , $ ContentType ) {
91
+ return $ this ->sendRequest ('featured/ ' . $ Group . '/ ' . $ ContentType , ["sessionId " => $ this ->sessionId , "countryCode " => $ this ->countryCode ]);
92
+ }
93
+
94
+ public function getUser ($ UserId ) {
95
+ return $ this ->sendRequest ('users/ ' . $ UserId , ["sessionId " => $ this ->sessionId , "countryCode " => $ this ->countryCode ]);
96
+ }
97
+
98
+ public function getUserPlaylist ($ UserId ) {
99
+ return $ this ->sendRequest ('users/ ' . $ UserId . '/playlists ' , ["sessionId " => $ this ->sessionId , "countryCode " => $ this ->countryCode ]);
100
+ }
101
+
102
+ public function getPlaylist ($ PlaylistId ) {
103
+ return $ this ->sendRequest ('playlists/ ' . $ PlaylistId , ["sessionId " => $ this ->sessionId , "countryCode " => $ this ->countryCode ]);
104
+ }
105
+
106
+ public function getPlaylistTracks ($ PlaylistId ) {
107
+ // need parse because getting tracks and videos
108
+ return $ this ->sendRequest ('playlists/ ' . $ PlaylistId . '/tracks ' , ["sessionId " => $ this ->sessionId , "countryCode " => $ this ->countryCode ]);
109
+ }
110
+
111
+ public function getPlaylistVideos ($ PlaylistId ) {
112
+ return $ this ->sendRequest ('playlists/ ' . $ PlaylistId . '/items ' , ["sessionId " => $ this ->sessionId , "countryCode " => $ this ->countryCode ]);
113
+ }
114
+
115
+ public function getPlaylistItems ($ PlaylistId ) {
116
+ return $ this ->sendRequest ('playlists/ ' . $ PlaylistId . '/items ' , ["sessionId " => $ this ->sessionId , "countryCode " => $ this ->countryCode ]);
117
+ }
118
+
119
+ public function getAlbum ($ AlbumId ) {
120
+ return $ this ->sendRequest ('albums/ ' . $ AlbumId , ["sessionId " => $ this ->sessionId , "countryCode " => $ this ->countryCode ]);
121
+ }
122
+
123
+ public function getAlbumTracks ($ AlbumId ) {
124
+ return $ this ->sendRequest ('albums/ ' . $ AlbumId . '/tracks ' , ["sessionId " => $ this ->sessionId , "countryCode " => $ this ->countryCode ]);
125
+ }
126
+
127
+ public function getAlbumVideos ($ AlbumId ) {
128
+ // need parse because getting tracks and videos
129
+ return $ this ->sendRequest ('albums/ ' . $ AlbumId . '/items ' , ["sessionId " => $ this ->sessionId , "countryCode " => $ this ->countryCode ]);
130
+ }
131
+
132
+ public function getAlbumItems ($ AlbumId ) {
133
+ return $ this ->sendRequest ('albums/ ' . $ AlbumId . '/items ' , ["sessionId " => $ this ->sessionId , "countryCode " => $ this ->countryCode ]);
134
+ }
135
+
136
+ public function getArtist ($ ArtistId ) {
137
+ return $ this ->sendRequest ('artists/ ' . $ ArtistId , ["sessionId " => $ this ->sessionId , "countryCode " => $ this ->countryCode ]);
138
+ }
139
+
140
+ public function getArtistAlbums ($ ArtistId ) {
141
+ return $ this ->sendRequest ('artists/ ' . $ ArtistId . '/albums ' , ["sessionId " => $ this ->sessionId , "countryCode " => $ this ->countryCode ]);
142
+ }
143
+
144
+ public function getArtistAlbums_Singles ($ ArtistId ) {
145
+ return $ this ->sendRequest ('artists/ ' . $ ArtistId . '/albums ' , ["sessionId " => $ this ->sessionId , "countryCode " => $ this ->countryCode , "filter " => "EPSANDSINGLES " ]);
146
+ }
147
+
148
+ public function getArtistAlbums_Other ($ ArtistId ) {
149
+ return $ this ->sendRequest ('artists/ ' . $ ArtistId . '/albums ' , ["sessionId " => $ this ->sessionId , "countryCode " => $ this ->countryCode , "filter " => "COMPILATIONS " ]);
150
+ }
151
+
152
+ public function getArtistTopTracks ($ ArtistId ) {
153
+ return $ this ->sendRequest ('artists/ ' . $ ArtistId . '/toptracks ' , ["sessionId " => $ this ->sessionId , "countryCode " => $ this ->countryCode ]);
154
+ }
155
+
156
+ public function getArtistVideos ($ ArtistId ) {
157
+ return $ this ->sendRequest ('artists/ ' . $ ArtistId . '/videos ' , ["sessionId " => $ this ->sessionId , "countryCode " => $ this ->countryCode ]);
158
+ }
159
+
160
+ public function getArtistBio ($ ArtistId ) {
161
+ return $ this ->sendRequest ('artists/ ' . $ ArtistId . '/bio ' , ["sessionId " => $ this ->sessionId , "countryCode " => $ this ->countryCode ]);
162
+ }
163
+
164
+ public function getArtistSimilar ($ ArtistId ) {
165
+ return $ this ->sendRequest ('artists/ ' . $ ArtistId . '/similar ' , ["sessionId " => $ this ->sessionId , "countryCode " => $ this ->countryCode ]);
166
+ }
167
+
168
+ public function getArtistRadio ($ ArtistId ) {
169
+ return $ this ->sendRequest ('artists/ ' . $ ArtistId . '/radio ' , ["sessionId " => $ this ->sessionId , "countryCode " => $ this ->countryCode ]);
170
+ }
171
+
172
+ public function getAlbumPhoto ($ AlbumPhotoId , $ Size = 1080 ) {
173
+ return "https://resources.tidal.com/images/ " . $ AlbumPhotoId . "/ " . $ Size . "x " . $ Size . ".jpg " ;
174
+ }
175
+
176
+
177
+
50
178
private function sendRequest ($ Method , $ Params , $ Headers = NULL ) {
51
- $ url = $ this ->urlCreate ($ Method );
52
- return $ sendReq = $ this ->client ->get ($ url ,
53
- [
54
- 'query ' => $ Params ,
55
- 'headers ' => $ Headers
56
- ])->getBody ();
179
+ if (!isset ($ this ->sessionId , $ this ->countryCode )) {
180
+ echo "Please first log in, You Didnt Login \n" ;
181
+ } else {
182
+ $ url = $ this ->urlCreate ($ Method );
183
+ return $ sendReq = $ this ->client ->get ($ url ,
184
+ [
185
+ 'query ' => $ Params ,
186
+ 'headers ' => $ Headers
187
+ ])->getBody ();
188
+ }
57
189
}
58
190
59
191
private function urlCreate ($ method ) {
0 commit comments