글쎄, Spotify API를 통해 함수 preview_url
을 추출하려고 합니다만, 코드 뒤에이 기능을 사용할 수 없으므로 귀하의 도움을 요청할 것입니다. 내가 원하는 기능spotify API를 통해 Preview_Url을 추출하십시오.
$get_json->tracks->items[0]->artists[1]->external_urls->preview_url;
"preview_url" : "https://p.scdn.co/mp3-preview/5dcd99cf811094408dcfc1befe014495d786dab5",
{
"artists" : {
"href" : "https://api.spotify.com/v1/search?query=MAROON+5+ANIMALS&offset=0&limit=1&type=artist",
"items" : [ ],
"limit" : 1,
"next" : null,
"offset" : 0,
"previous" : null,
"total" : 0
},
"tracks" : {
"href" : "https://api.spotify.com/v1/search?query=MAROON+5+-+ANIMALS&offset=0&limit=1&type=track",
"items" : [ {
"album" : {
"album_type" : "album",
"artists" : [ {
"external_urls" : {
"spotify" : "https://open.spotify.com/artist/04gDigrS5kc9YWfZHwBETP"
},
"href" : "https://api.spotify.com/v1/artists/04gDigrS5kc9YWfZHwBETP",
"id" : "04gDigrS5kc9YWfZHwBETP",
"name" : "Maroon 5",
"type" : "artist",
"uri" : "spotify:artist:04gDigrS5kc9YWfZHwBETP"
} ],
"available_markets" : [ "CA", "MX", "US" ],
"external_urls" : {
"spotify" : "https://open.spotify.com/album/2Auw0pTT6EcQdvHNimhLQI"
},
"href" : "https://api.spotify.com/v1/albums/2Auw0pTT6EcQdvHNimhLQI",
"id" : "2Auw0pTT6EcQdvHNimhLQI",
"images" : [ {
"height" : 640,
"url" : "https://i.scdn.co/image/4c23a82f33b034795a0fbc67af559420c8cb4928",
"width" : 640
}, {
"height" : 300,
"url" : "https://i.scdn.co/image/44b0e6423240ed25f36f351ae043f68bb2ca3446",
"width" : 300
}, {
"height" : 64,
"url" : "https://i.scdn.co/image/2e8ff05c6f96006130bbc64ef0b42b402252ace8",
"width" : 64
} ],
"name" : "V",
"type" : "album",
"uri" : "spotify:album:2Auw0pTT6EcQdvHNimhLQI"
},
"artists" : [ {
"external_urls" : {
"spotify" : "https://open.spotify.com/artist/04gDigrS5kc9YWfZHwBETP"
},
"href" : "https://api.spotify.com/v1/artists/04gDigrS5kc9YWfZHwBETP",
"id" : "04gDigrS5kc9YWfZHwBETP",
"name" : "Maroon 5",
"type" : "artist",
"uri" : "spotify:artist:04gDigrS5kc9YWfZHwBETP"
} ],
"available_markets" : [ "CA", "MX", "US" ],
"disc_number" : 1,
"duration_ms" : 231012,
"explicit" : false,
"external_ids" : {
"isrc" : "USUM71409576"
},
"external_urls" : {
"spotify" : "https://open.spotify.com/track/2bL2gyO6kBdLkNSkxXNh6x"
},
"href" : "https://api.spotify.com/v1/tracks/2bL2gyO6kBdLkNSkxXNh6x",
"id" : "2bL2gyO6kBdLkNSkxXNh6x",
"name" : "Animals",
"popularity" : 69,
"preview_url" : "https://p.scdn.co/mp3-preview/5dcd99cf811094408dcfc1befe014495d786dab5",
"track_number" : 2,
"type" : "track",
"uri" : "spotify:track:2bL2gyO6kBdLkNSkxXNh6x"
} ],
"limit" : 1,
"next" : "https://api.spotify.com/v1/search?query=MAROON+5+-+ANIMALS&offset=1&limit=1&type=track",
"offset" : 0,
"previous" : null,
"total" : 99
}
}
코드
도와 주시겠습니까? 고맙습니다!
귀하의 질문을 게시하기 전에 수행 한 연구는 무엇입니까? 뭐가 나왔어? –
@ OleV.V. 나는이 사이트를 검색해 왔으며이 답변 질문 (http://stackoverflow.com/questions/39913982/php-code-to-retrieve-cover-album-via-spotify-api)을 발견하고 질문이 있지만 성공하지 못하거나 표시된 함수의 preview_url을 제거하십시오. –