Git Product home page Git Product logo

siriusxm's People

Contributors

andrew0 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

siriusxm's Issues

Session Timeout

Everything seems to be working great on my new setup, but running into a some sort of timeout on the streams. All streams seem to stop after a few hours. When I check back on the script I see a message about 'session expired'. Re-running the script connects it once again.

Is the a way to keep the steam running continuously? Am I missing something?

Doesn't work since yesterday

Since yesterday I only get an exception when I tried to stream a channel.

28.Nov 2018 13:13:57 : Received error 100 Successful

Traceback (most recent call last):
File "/usr/lib/python3.5/socketserver.py", line 313, in _handle_request_noblock
self.process_request(request, client_address)
File "/usr/lib/python3.5/socketserver.py", line 341, in process_request
self.finish_request(request, client_address)
File "/usr/lib/python3.5/socketserver.py", line 354, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python3.5/socketserver.py", line 681, in init
self.handle()
File "/usr/lib/python3.5/http/server.py", line 422, in handle
self.handle_one_request()
File "/usr/lib/python3.5/http/server.py", line 410, in handle_one_request
method()
File "sxm.py", line 318, in do_GET
data = self.sxm.get_playlist(self.path.rsplit('/', 1)[1][:-5])
File "sxm.py", line 233, in get_playlist
res = self.session.get(url, params=params)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 492, in get
return self.request('GET', url, **kwargs)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 466, in request
prep = self.prepare_request(req)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 400, in prepare_request
hooks=merge_hooks(request.hooks, self.hooks),
File "/usr/lib/python3/dist-packages/requests/models.py", line 293, in prepare
self.prepare_url(url, params)
File "/usr/lib/python3/dist-packages/requests/models.py", line 353, in prepare_url
raise MissingSchema(error)
requests.exceptions.MissingSchema: Invalid URL 'None': No schema supplied. Perhaps you meant http://None?

Another is this still working ?

Stumbled across this and it looks like it might solve my squeezebox issue. I know nothing about python, which will probably become obvious in the next few sentences...

I've created a windows vm and install python for windows 3.7.0 and the python launcher.

Running the command mentioned in the readme with like this:
python sxm.py '[email protected]' 'Mypassword' 8888 resulted in a

ModuleNotFoundError: No module named 'requests'

so I found what I think is the requests module here: https://github.com/requests/requests

and cloned that next to the script itself.

now when I run it I get:

Traceback (most recent call last):
  File "sxm.py", line 352, in <module>
    httpd = HTTPServer(('', int(sys.argv[3])), make_sirius_handler(sys.argv[1],
sys.argv[2]))
  File "sxm.py", line 312, in make_sirius_handler
    class SiriusHandler(BaseHTTPRequestHandler):
  File "sxm.py", line 314, in SiriusHandler
    sxm = SiriusXM(username, password)
  File "sxm.py", line 15, in __init__
    self.session = requests.Session()
AttributeError: module 'requests' has no attribute 'Session'

What am I doin wrong?

Systemd unit files

If anyone cares, I created a generic systemd unit file on my fork: https://github.com/fts-tmassey/SiriusXM

If someone chooses to use my updated script, there's also an override file you can look at that shows how I use environment variables to safely store my credentials yet still start the script automatically.

A big thank you to andrew0 for his script: it's awesome for me to now have SXM in every room of my house!

JSONDecodeError: Expecting ',' delimiter

EDIT: Finally understood that it was a missing "," not in the sxm.py, but in my config.json – I fixed that, and now the recording script seems to work!! Just started it, but hopefully I managed to get it working now. If yes, I'll close this issue as soon as I found out.

EDIT 2: I've figured everything out now – it works! Thanks so much for this fantastic script and the work which went into it, highly appreciated! Closing this issue now. (Feel free to delete the whole thing, if you wish – I can't do this as the poster, if I see it correctly.)


I'm unfortunately not very familiar with coding and Python, but I am trying my best to get the SiriusXM script for the ripping server running to record my favourite Underground Garage shows. I managed to set up the simple streaming server for playing the channel in VLC/Quicktime – however, starting the server in ripping mode gives me headaches. At the moment, I get this message when trying to start it:

Traceback (most recent call last):
File "/Users/lars/SiriusXM-master/sxm.py", line 868, in
main()
File "/Users/lars/SiriusXM-master/sxm.py", line 841, in main
ripper = SiriusXMRipper(sirius_handler, args)
File "/Users/lars/SiriusXM-master/sxm.py", line 552, in init
self.config = json.load(open("/Users/lars/SiriusXM-master/config.json", "r"))
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/init.py", line 293, in load
return loads(fp.read(),
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/init.py", line 357, in loads
return _default_decoder.decode(s)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting ',' delimiter: line 19 column 2 (char 570)

Could the problem be that the config.json isn't found? I put the file in the same folder as the sxm.py, but it wasn't found ("[Errno 2] No such file or directory: 'config.json") – so I added the correct full path to the config.json into the script at the three lines where it is directly consulted. Does the JSONDecodeError tell me that the file still isn't found? And do the lines above that tell me that I also still have other problems running the script?

Sorry for the confusion, but I'm totally lost with this – I would be so grateful if anybody could help me out what to exactly change in the script. This is how I saved it at the moment:

https://www.dropbox.com/s/mqx339wjcsfl0hf/sxm.py?dl=0

Thanks so much in advance!!! (and sorry for bad technical English – no native speaker ...)

Authentication Failure Suddenly

First of all, thanks for such a great project. It worked great for me for months, but just today (9/18/19), I was no longer able to stream due to an authentication failure:

WARNING:/usr/local/lib/python3.7/dist-packages/sxm/client.py:Received status code 403 for path 'modify/authentication'
ERROR:/usr/local/lib/python3.7/dist-packages/sxm/client.py:Unable to authenticate because login failed
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/tenacity/init.py", line 361, in call
result = fn(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/sxm/client.py", line 233, in authenticate
raise AuthenticationError("Reset session")
sxm.client.AuthenticationError: Reset session

I found that by changing the FakeUserAgent signature from "chrome" to "firefox" in client.py, I was able to get it going again. I don't know if they had put a trap in the handling on their end to fix something that was broken in the Chrome browser, or if they are trying to pick off rogue clients by their User-agent signature.

With your knowledge of the handshaking, you may be able to diagnose this more deeply than I am currently able to.

Authentication Error "Unable to authenticate because login failed"

ETA: Or, just use kryptek's fork: https://github.com/kryptek/SiriusXM It already has the fix, as well as additional features...

This is the same as Issue #20 which is marked closed (so I didn't find it and had to re-debug and re-create it...). I'm opening a new issue here to hopefully save others the pain... Pull Request 29: #29

Getting "Unable to authenticate because login failed" when trying to connect. Could login successfully using https://player.siriusxm.com so credentials were correct. Examining the cookies within the browser seem to indicate that SXM changed "SXMAUTH" to "SXMAUTHNEW". Updated code and was able to list/play channels.

Hopefully the code can get pulled in when this issue is closed this time... :) Until then, find the following:

    return 'SXMAUTH' in self.session.cookies

and change it to SXMAUTHNEW and you'll be all set!

Pass credentials in environment variables

Hello!

Passing credentials (username and password) on the command line is no bueno: it's trivial to see the command line of a task running on a system! Plus, if you start your task with e.g. systemd, you will need to hard-code your password into your unit files. Not for me.

So, I modified the code to add an -e (--env) parameter. That allows the SXM_USER and SXM_PASS variables to override the username and password passed on the command line. Combined with the EnvironmentFile parameter of a systemd unit file, this will allow you to store your credentials to be stored in a file (owned by, say, root with 400 ownership).

I wanted to change the underlying code as little as possible, so the username and password parameters are still required: I just use "user" and "pass". With the -e parameter, they will get overwritten by the environment variables (if the variables exist). If the author wanted to clean this up further (like not using the parameter in the first place and simply defining that the environment variables work all the time, and possibly allowing the username and password parameters to be optional if the environment variables exist), that would be trivial. In fact, I volunteer to do that if andrew0 wants me to (and will check in the results!!!). Otherwise, my changes are as minimal as possible and meet my needs. Hopefully they might meet yours, too.

A shout out to kryptek and his fork here: https://github.com/kryptek/SiriusXM He has a more comprehensive way of doing this with configuration files, plus more features. However, his script requires more modules, etc. and I don't personally need those features (mostly recording SXM streams) so I'm sticking with the basic script with my couple of patches.

Unable to authenticate, unable to get channel list

Did this stop working for anyone else recently? I now get this error. I have already updated SXMAUTH to SXMAUTHNEW and its been working for me for months.

13.Jun 2021 19:41:08 : Unable to authenticate
13.Jun 2021 19:41:08 : Unable to get channel list

Exception happened during processing of request from ('192.168.0.120', 59983)
Traceback (most recent call last):
File "/usr/lib/python3.8/socketserver.py", line 316, in _handle_request_noblock
self.process_request(request, client_address)
File "/usr/lib/python3.8/socketserver.py", line 347, in process_request
self.finish_request(request, client_address)
File "/usr/lib/python3.8/socketserver.py", line 360, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python3.8/socketserver.py", line 720, in init
self.handle()
File "/usr/lib/python3.8/http/server.py", line 427, in handle
self.handle_one_request()
File "/usr/lib/python3.8/http/server.py", line 415, in handle_one_request
method()
File "sxm.py", line 323, in do_GET
data = sxm.get_playlist(self.path.rsplit('/', 1)[1][:-5])
File "sxm.py", line 227, in get_playlist
guid, channel_id = self.get_channel(name)
File "sxm.py", line 313, in get_channel
if x.get('name', '').lower() == name or x.get('channelId', '').lower() == name or x.get('siriusChannelNumber') == name:
AttributeError: 'NoneType' object has no attribute 'get'

13.Jun 2021 19:41:08 : Unable to authenticate
13.Jun 2021 19:41:08 : Unable to get channel list

Exception happened during processing of request from ('192.168.0.120', 59984)
Traceback (most recent call last):
File "/usr/lib/python3.8/socketserver.py", line 316, in _handle_request_noblock
self.process_request(request, client_address)
File "/usr/lib/python3.8/socketserver.py", line 347, in process_request
self.finish_request(request, client_address)
File "/usr/lib/python3.8/socketserver.py", line 360, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python3.8/socketserver.py", line 720, in init
self.handle()
File "/usr/lib/python3.8/http/server.py", line 427, in handle
self.handle_one_request()
File "/usr/lib/python3.8/http/server.py", line 415, in handle_one_request
method()
File "sxm.py", line 323, in do_GET
data = sxm.get_playlist(self.path.rsplit('/', 1)[1][:-5])
File "sxm.py", line 227, in get_playlist
guid, channel_id = self.get_channel(name)
File "sxm.py", line 313, in get_channel
if x.get('name', '').lower() == name or x.get('channelId', '').lower() == name or x.get('siriusChannelNumber') == name:
AttributeError: 'NoneType' object has no attribute 'get'

HLS_AES_KEY question

Can you explain how you were able to get the HLS stream key? I've tried doing some research on how to recover the key from HLS streams but haven't had much luck.

Empty .m3u8

Hi, i don't get the proper stream playlist,
am i doing something wrong ?

Can't Authenticate

I am trying to use this script, but it always says that it is unable to authenticate. I verified that the username (in my case my email address) and my password work correctly if I try to login at https://player.siriusxm.com/login but it doesn't seem to work with this script. Any ideas on what to try? Here's the log when I try to connect via VLC to a channel.

08.May 2020 18:54:13 <SiriusXM>: Unable to authenticate because login failed
08.May 2020 18:54:13 <SiriusXM>: Unable to authenticate
08.May 2020 18:54:13 <SiriusXM>: Unable to get channel list
----------------------------------------
Exception happened during processing of request from ('192.168.0.189', 49565)
Traceback (most recent call last):
  File "/usr/lib/python3.7/socketserver.py", line 316, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/lib/python3.7/socketserver.py", line 347, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib/python3.7/socketserver.py", line 360, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python3.7/socketserver.py", line 720, in __init__
    self.handle()
  File "/usr/lib/python3.7/http/server.py", line 426, in handle
    self.handle_one_request()
  File "/usr/lib/python3.7/http/server.py", line 414, in handle_one_request
    method()
  File "sxm.py", line 323, in do_GET
    data = sxm.get_playlist(self.path.rsplit('/', 1)[1][:-5])
  File "sxm.py", line 227, in get_playlist
    guid, channel_id = self.get_channel(name)
  File "sxm.py", line 313, in get_channel
    if x.get('name', '').lower() == name or x.get('channelId', '').lower() == name or x.get('siriusChannelNumber') == name:
AttributeError: 'NoneType' object has no attribute 'get'
----------------------------------------
08.May 2020 18:54:13 <SiriusXM>: Unable to authenticate because login failed
08.May 2020 18:54:13 <SiriusXM>: Unable to authenticate
08.May 2020 18:54:13 <SiriusXM>: Unable to get channel list
----------------------------------------
Exception happened during processing of request from ('192.168.0.189', 49566)
Traceback (most recent call last):
  File "/usr/lib/python3.7/socketserver.py", line 316, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/lib/python3.7/socketserver.py", line 347, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib/python3.7/socketserver.py", line 360, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python3.7/socketserver.py", line 720, in __init__
    self.handle()
  File "/usr/lib/python3.7/http/server.py", line 426, in handle
    self.handle_one_request()
  File "/usr/lib/python3.7/http/server.py", line 414, in handle_one_request
    method()
  File "sxm.py", line 323, in do_GET
    data = sxm.get_playlist(self.path.rsplit('/', 1)[1][:-5])
  File "sxm.py", line 227, in get_playlist
    guid, channel_id = self.get_channel(name)
  File "sxm.py", line 313, in get_channel
    if x.get('name', '').lower() == name or x.get('channelId', '').lower() == name or x.get('siriusChannelNumber') == name:
AttributeError: 'NoneType' object has no attribute 'get'```

Able to play the stream, but the channel list request is returning partial information

Thanks for the new edition of sxm.py Got that running this afternoon.

The server is working, but when I request the channel listing I get partial information. Here is the example:

python sxm.py -u [USERNAME] -p [PASSWORD] -l
ID | Num | Name
9188 | ? |
rawdog | ? |
9189 | ? |
undergroundgarage | ? |
9181 | ? |
9186 | ? |
9187 | ? |
9185 | ? |
radioclassics | ? |
0000 | ? |
9191 | ? |
thebeat | ? |
9190 | ? |
thebridge | ? |
doctorradio | ? |
espnradio | ? |
...

Thanks again for your hard work on this.

Updated list of Channels

Hello Andrew (or whomever knows)

How would one go about pooling SiriusXM to get an updated channel listing so we can add new channels as they are released?

Convert to a Proper Python Package

First off, awesome job on this. This repo is going my life like 100 times easier!

Would you be interested in actually converting this into a installable package and possibly even uploading it to PyPi?

If so I can make a pull request/work with you to get it all put together. My plan was actually to build a Discord bot that could play SiriusXM so being able to pip install sxm and importing the SiriusXM class would be a huge help so I do not have to reference the Github repo directly.

Error parsing json response for all channels

18.Jul 2020 09:51:28 : Error parsing json response for channels
18.Jul 2020 09:51:28 : No channel for 9402
127.0.0.1 - - [18/Jul/2020 09:51:28] "GET /9402.m3u8 HTTP/1.1" 500 -

I have tried numerous with the same result. Seems to have broken sometime over the last 7 days.

Bad request

Worked fine yesterday, but now get

127.0.0.1 - - [22/Aug/2020 15:34:26] code 400, message Bad request version ('Zß²\x17b)\x81?tl\x95|\x00\x00,\x00ÿÀ,À+À$À#À')
Zß²b)�?tl�|,ÿÀ,À+À$À#À" 400 -:34:26] "¤ _A�R�Ä>Î|UH+��yÂ�#

Using the kryptek branch.

Edit: Happens sporadically. Unknown cause.

Authenication error

Been using this since Oct 2019 and love it. Enables me to time shift record content from SiriusXM.

Everything worked fine on Tuesday 4/28/2020. When I tried to get the updated channel list on Friday 5/1, I get an authentication error. I have tried a few more times and still get the error.

Have no idea on what has changed, but the python code no longer goes further.

Hoping this is easy to fix. Will miss my regular program recording.

Playlist is made, but the .aac files in it don't play

When I run http://127.0.0.1:9001:34 (as per example) in a media player or browser, the playlist is created, but the .aac files don't actually play. The app(s) I try just iterate through all of the files in the playlist as quick as it can, as if they are not actually good?

EDIT It seems this is not working because of SXM removing legacy player support.

it looks like this (with many more .aac entries):

EXTM3U

EXT-X-VERSION:1

EXT-X-TARGETDURATION:10

EXT-X-MEDIA-SEQUENCE:670507

EXT-X-ALLOW-CACHE:NO

EXT-X-KEY:METHOD=AES-128,URI="key/1"

EXT-X-PROGRAM-DATE-TIME:2016-06-09T09:05:40.944+00:00

EXTINF:10,

90salternative_256k_1_060932740944_00670507_v3.aac

EXT-X-PROGRAM-DATE-TIME:2016-06-09T09:05:50.697+00:00

EXTINF:10,

90salternative_256k_1_060932750697_00670508_v3.aac

EXT-X-PROGRAM-DATE-TIME:2016-06-09T09:06:00.450+00:00

Using script in Logitech Media Server

I started using this script in LMS to replace the no longer supported Official SiriusXM stream. It works well until I change stations. The new station plays for a while then stops. The python terminal output shows a lot of 403 Forbidden errors when I select a different station and appears to be attempting to stream both the old and new selection. I'm not very familiar with python but shouldn't the previous stream be terminated in favor of the new one?

Authentication Failure

Unable to authenticate with script. Receive the following:

<SiriusXM>: Unable to authenticate because login failed <SiriusXM>: Unable to authenticate <SiriusXM>: Unable to get channel list Traceback (most recent call last): raceback (most recent call last): File "sxm.py", line 362, in <module> channels = list(sorted(sxm.get_channels(), key=lambda x: (not x.get('isFavorite', False), int(x.get('siriusChannelNumber', 9999))))) File "sxm.py", line 362, in <lambda> channels = list(sorted(sxm.get_channels(), key=lambda x: (not x.get('isFavorite', False), int(x.get('siriusChannelNumber', 9999))))) AttributeError: 'NoneType' object has no attribute 'get'

I am using trying to run the scrip via sudo python3 sxm.py username password -p 8888

What am I missing? is this script still working ?

Error when trying to stream on Onkyo receiver

The Onkyo TX-NR709 has a favorite option they can custom stream links added to. I put the link http://192.168.1.200:8888/9486.m3u8 that works using VLC in the Onkyo and it generates the error information below. I don't have details on what the Onkyo supports but it will play acc streams. This is one that works http://wfuv-onair.streamguys.org:80/onair-aacplus. I realize sxm.py is different than the wfuv one and it may not be possible. Any thoughts or suggestions?

Onkyo:
Connection Error.
The server connection could not be established or was terminated early. Please try again later.

sxm.py:
Exception happened during processing of request from ('192.168.1.50', 47958)
Traceback (most recent call last):
File "/usr/lib/python3.6/socketserver.py", line 317, in _handle_request_noblock
self.process_request(request, client_address)
File "/usr/lib/python3.6/socketserver.py", line 348, in process_request
self.finish_request(request, client_address)
File "/usr/lib/python3.6/socketserver.py", line 361, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python3.6/socketserver.py", line 721, in init
self.handle()
File "/usr/lib/python3.6/http/server.py", line 418, in handle
self.handle_one_request()
File "/usr/lib/python3.6/http/server.py", line 406, in handle_one_request
method()
File "./sxm.py", line 324, in do_GET
self.wfile.write(bytes(data, 'utf-8'))
File "/usr/lib/python3.6/socketserver.py", line 800, in write
self._sock.sendall(b)
BrokenPipeError: [Errno 32] Broken pipe

Broken Pipe message & empty playlist

I have stepped through the code, it seems to be failing around self.wfile.write(res.text)

I can not find any reason for this, as I am not very familiar with python.

What Version of Python

What version of Python should I be running for this to run correctly? I've tried 2.7 and 3.4

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.