plintx / mopidy-radionet

Mopidy extension for playing music from radio.net http://www.mopidy.com
Apache License 2.0
11 stars 5 forks source link

API stopped working? #16

Open daniele-athome opened 3 years ago

daniele-athome commented 3 years ago

I can't find any news on the Internet, but did the API stopped working?

$ curl -vk https://api.radio.it/info/v2
< HTTP/1.1 410 Gone
< Date: Thu, 19 Aug 2021 07:38:08 GMT
< Server: Varnish
< X-Varnish: 853234572
< Age: 0
< Via: 1.1 varnish (Varnish/6.5)
< Content-Length: 0
< Connection: keep-alive

Mopidy logs:

  File "/usr/local/lib/python3.7/dist-packages/mopidy_radionet/radionet.py", line 100, in do_get
    self.get_api_key()
  File "/usr/local/lib/python3.7/dist-packages/mopidy_radionet/radionet.py", line 83, in get_api_key
    self.api_key = apikey_search.group(1)
AttributeError: 'NoneType' object has no attribute 'group'
miskor-bgd commented 3 years ago

Same here...

kokosowy commented 3 years ago

Well, in this thread radio.net support told me we are using here deprecated API, it was matter of time it will be gone.

miskor-bgd commented 3 years ago

@kokosowy I found out your post while searching the github but I simply didn't believe it would happen on my first ever mopidy installation with radionet extension, damn...

kokosowy commented 3 years ago

@miskor-bgd I know how you feel, bro. Mopidy-RadioNet was pretty neat. I hope @plintx @TrollDecker or miesli will figure something out. In the meantime you can browse https://mopidy.com/ext/ for other solution, perhaps Mopidy-TuneIn will suit you well.

ArtUrim commented 3 years ago

I've done a bit of debugging. Seems that there is no 'apiKey ?: ?[\'|"](.*)[\'|"],?' regex in the http response to the https://api.radio.net/info/v2

At first glance, the issue is not hard to resolve, the question is what's the meaning of the apiKey ? I suppose that this is a token for the connection to the radio.net...

TrollDecker commented 3 years ago

My understanding was that the API key was provided by radio.net when the Mopidy plugin registered itself to the service and would then be saved in that apiKey field.

I can't check at the mo myself, but it does look like the API might have finally been shuttered if it can't get one, and like @kokosowy said, it was only a matter of time anyway. 🙁

It's a shame, because TuneIn isn't a viable option in the UK anymore (Warner et al threw a tantrum and a lawyer at them over allowing people to listen to international stations), but that's another matter.😒

MiKiL75 commented 3 years ago

It seems that API key is still available but it is bit buried in the code. It is now in file: https://www.radio.net/_next/static/chunks/3-742de185a8222d3ddab4.js In that file, there is code that creates embedded player with all the needed information, that code has "data-apikey" variable.

Tested loading topstations in browser (https://api.radio.net/info/v2/search/topstations?apikey=) with that "data-apikey"-value and seems to work.

Emrvb commented 3 years ago

I've been investigating this issue as well and found that this addon is not really nice with its API access. It's really hammering it with unnecessary and redundant requests. I'm willing to refactor this, but would like to know the demand first. Is there any advantage to radio.de compared to tunein? (haven't tried tunein myself yet)

Edit:

Read TrollDeckers comment, so there is demand from users in the UK. Anything else?

kokosowy commented 3 years ago

Hi @MiKiL75 @Emrvb nice to hear from you. It's a relief API is still there, but way accessing it changed a little, I thought it's worse.

Definitely this module is very nice to have. Both have differences regarding radio stations catalogue and also as far as I know TuneIn has some regional limitations.

Thank you for looking at it.

ffes commented 1 year ago

I run into exactly the same problem. The very first call from the MPD client to my server gives this exception.

ERROR    2022-11-23 19:19:49,959 [1:Core-12 (_actor_loop)] mopidy.core.library
  RadioNetBackend backend caused an exception.
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/mopidy/core/library.py", line 17, in _backend_error_handling
    yield
  File "/usr/lib/python3/dist-packages/mopidy/core/library.py", line 114, in _browse
    result = backend.library.browse(uri).get()
  File "/usr/lib/python3/dist-packages/pykka/_threading.py", line 45, in get
    _compat.reraise(*self._data['exc_info'])
  File "/usr/lib/python3/dist-packages/pykka/_compat/__init__.py", line 29, in reraise
    raise value
  File "/usr/lib/python3/dist-packages/pykka/_actor.py", line 193, in _actor_loop
    response = self._handle_receive(envelope.message)
  File "/usr/lib/python3/dist-packages/pykka/_actor.py", line 299, in _handle_receive
    return callee(*message.args, **message.kwargs)
  File "/usr/local/lib/python3.10/dist-packages/mopidy_radionet/library.py", line 49, in browse
    self.backend.refresh()
  File "/usr/local/lib/python3.10/dist-packages/mopidy_radionet/backend.py", line 45, in refresh
    self.radionet.get_top_stations()
  File "/usr/local/lib/python3.10/dist-packages/mopidy_radionet/radionet.py", line 217, in get_top_stations
    response = self.do_post(api_suffix, url_params)
  File "/usr/local/lib/python3.10/dist-packages/mopidy_radionet/radionet.py", line 89, in do_post
    self.get_api_key()
  File "/usr/local/lib/python3.10/dist-packages/mopidy_radionet/radionet.py", line 83, in get_api_key
    self.api_key = apikey_search.group(1)
AttributeError: 'NoneType' object has no attribute 'group'

I hope that #18 will solve this, because at the moment the extension doesn't work for me.

9acca9 commented 1 year ago

So... this is not working anymore? This have a lot of radio from my country... so sad.

MiKiL75 commented 1 year ago

So... this is not working anymore? This have a lot of radio from my country... so sad.

Have you checked #18 by Emrvb? It does work for me at the moment and I've been using it in my raspi4 radio.

kokosowy commented 1 year ago

I don’t understand why that pull request was not merged so far. It fixes the problem. Everybody who try extension see it’s just not working and people install other one.

9acca9 commented 1 year ago

So... this is not working anymore? This have a lot of radio from my country... so sad.

Have you checked #18 by Emrvb? It does work for me at the moment and I've been using it in my raspi4 radio.

sorry my dumb question but....... how i try that? how i install that? Thanks.

edit: i did it like this https://github.com/plintx/mopidy-radionet/pull/18#issuecomment-1155756129 thanks!

pataquets commented 1 year ago

I guess an info notice in the readme, linking to this issue, would be in order. It would prevent wasting time (for people who can't fix it themselves) and also point possible interested parties into jumping in to fix it (btw, I'd like to +1 @9acca9 question on how to help test a possible fix).

pataquets commented 1 year ago

I guess an info notice in the readme, linking to this issue, would be in order. It would prevent wasting time (for people who can't fix it themselves) and also point possible interested parties into jumping in to fix it (btw, I'd like to +1 @9acca9 question on how to help test a possible fix).

@plintx ping. Fancy to add a notice? Would you be open to merge a PR if you can't do it? Also, I would suggest you to set the project to archived state to prevent further noise.