Soundcloud具有允许任何曲目自动下载的功能,如果您添加" / download"到跟踪网址的末尾。
我们在soundcloud托管播客上使用了多年的功能:
http://techzinglive.com
http://soundcloud.com/techzing
截至几天前,该功能似乎已停止工作。
既然我们有300集,那么通过复制粘贴每集的下载链接就很难回头并回顾性地更改网址。
a)Soundcloud有什么方法可以解决这个问题吗?
b)是否存在做同样事情的替代方案?
示例:
168: TZ Interview - Patrick Collison / Stripe
~~~
http://soundcloud.com/techzing/techzing-168 (regular link)
http://soundcloud.com/techzing/techzing-168/download (auto download link)
注意:我是根据soundcloud支持页面的指示在此发布的。
答案 0 :(得分:1)
问题的答案是SoundCloud不再支持下载slug选项。但是你可以使用他们的API来使用它。
后端(PHP)
<?php
$yourSoundCloudClientId = '<CLIENTID>';
$yourSoundCloudTrackUrl = 'http://soundcloud.com/techzing/techzing-001';
if ( ! $trackData = json_decode(file_get_contents("http://api.soundcloud.com/resolve?url={$yourSoundCloudTrackUrl}&client_id={$yourSoundCloudClientId}")) )
{
die('Could not get the track because Soundcloud is down, or somethign else weird is happening.');
}
header("Location: {$trackData->download_url}?client_id={$yourSoundCloudClientId}");
?>
前端(JS)
<head>
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="https://connect.soundcloud.com/sdk/sdk-3.0.0.js"></script>
<script>
var yourSoundCloudClientId = '<CLIENTID>';
var yourSoundCloudTrackUrl = 'http://soundcloud.com/techzing/techzing-001';
SC.initialize
({
client_id: yourSoundCloudClientId
});
SC.get('/resolve?url='+yourSoundCloudTrackUrl).then
(
function(track)
{
$('#trackDiv').html('<iframe width="100%" height="450" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/'+track.id+'&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&visual=true"></iframe>');
}
);
</script>
</head>
<body>
<div id="trackDiv"></div>
</body>
原谅格式错误的HTML ......但是,你知道,它有效;)