1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 | # api: streamtuner2
# title: Soundcloud streams
# description: Convert soundcloud links from reddit to streamable tracks
# version: 0.2
# type: filter
# category: audio
# depends: python:soundcloud, action >= 1.1, reddit >= 0.8
# priority: rare
#
# Overrides action.play() function to convert soundcloud URLs
# to track/streaming address. Disables the reddit filter for
# walled gardens, and overrides any custom player configured
# for "audio/soundcloud" in settings.
import re
import soundcloud
from config import *
import ahttp
import action
fmt = "audio/soundcloud" |
|
|
>
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 | # api: streamtuner2
# title: Soundcloud streams
# description: Convert soundcloud links from reddit to streamable tracks
# version: 0.3
# type: filter
# category: audio
# depends: python:soundcloud, action >= 1.1, reddit >= 0.8
# priority: rare
#
# Hooks into action.play() function to convert soundcloud URLs
# to track/streaming address. Disables the reddit filter for
# walled gardens, and overrides any custom player configured
# for "audio/soundcloud" in settings.
import copy
import re
import soundcloud
from config import *
import ahttp
import action
fmt = "audio/soundcloud" |
40
41
42
43
44
45
46
47
48
49
50
51
52
53 | url = row["url"]
log.DATA_CONVERT_SOUNDCLOUD(url)
track = client().get('/resolve', url=url)
track_str = "/tracks/{}/stream".format(track.id)
url = client().get(track_str, allow_redirects=False).location
# override attributes
row["url"] = url
row["format"] = "audio/mpeg"
audioformat = "audio/mpeg"
source = "srv"
except Exception as e:
log.ERR_SOUNDCLOUD("URL resolving failed:", e) |
>
| 41
42
43
44
45
46
47
48
49
50
51
52
53
54
55 | url = row["url"]
log.DATA_CONVERT_SOUNDCLOUD(url)
track = client().get('/resolve', url=url)
track_str = "/tracks/{}/stream".format(track.id)
url = client().get(track_str, allow_redirects=False).location
# override attributes
row = copy.copy(row) # Throw away afterwards; tokens time out.
row["url"] = url
row["format"] = "audio/mpeg"
audioformat = "audio/mpeg"
source = "srv"
except Exception as e:
log.ERR_SOUNDCLOUD("URL resolving failed:", e) |