0

I am using soundcloud API with python and I'm trying to open url of the song with my browser. I use this code

client = soundcloud.Client(client_id=clientIdEntry.get())
track_url = urlEntry.get()
if track_url[0]!="h":
    track_url = "https://"+urlEntry.get()
else:
    track_url = urlEntry.get()
track = client.get('/resolve', url=track_url)
track_id = str(track.id)
track = client.get("/tracks/"+track_id)
stream_url = client.get(track.stream_url, allow_redirects=False)
print(track.title)
print("\n \n \n")
print(stream_url.location)
time.sleep(3)
os.system("chromium-browser "+stream_url.location)

But URL contains & character and terminal won't open the text that is behind that sign. Can anyone help me?

1

Try this

os.system("chromium-browser '"+stream_url.location+"'")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.