Skip to content

Commit f51bf5b

Browse files
committed
domains: allow to keep original player color for Soundcloud
1 parent c52e183 commit f51bf5b

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

plugins/domains/soundcloud.com/soundcloud.com.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import * as URL from 'url';
2+
13
export default {
24

35
provides: ['__allow_soundcloud_meta', 'sound'],
@@ -28,8 +30,15 @@ export default {
2830
}
2931
if (options.getRequestOptions('soundcloud.hide_artwork') !== undefined) {
3032
params.show_artwork = !options.getRequestOptions('soundcloud.hide_artwork');
31-
}
32-
if (options.getProviderOptions('soundcloud.color')) {
33+
}
34+
if (options.redirectsHistory && /^https:\/\/w\.soundcloud\.com\/player\//.test(options.redirectsHistory[0])) {
35+
var original = URL.parse(options.redirectsHistory[0], true).query?.color;
36+
var color = original && decodeURIComponent(original);
37+
if (color && !options.getProviderOptions('app.disable_url_options', false)) {
38+
params.color = color; // overide with provider options below, if any
39+
}
40+
}
41+
if (options.getRequestOptions('soundcloud.color')) {
3342
params.color = options.getProviderOptions('soundcloud.color');
3443
}
3544

0 commit comments

Comments
 (0)