Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Network unreachable #154

Open
stuckintraffic0 opened this issue Feb 1, 2024 · 16 comments
Open

Error: Network unreachable #154

stuckintraffic0 opened this issue Feb 1, 2024 · 16 comments

Comments

@stuckintraffic0
Copy link

Hello. I don't know why, but the library stopped working. It says: Error: Network unreachable, the command I used: songrec recognize mysong.mp3

@Bile1970
Copy link

Bile1970 commented Feb 1, 2024

I have the same problem. Error: Network unreachable.

I have multiple services running on my linux ubuntu,songrec became unstable in last 2-3 days.in some scripts songrec working fine,but in a more than half it doesnt work,the same error.

@marin-m
Copy link
Owner

marin-m commented Feb 1, 2024

Hello

Can you please paste the output of the curl -I https://amp.shazam.com/ and host amp.shazam.com commands (it may priorly require to install the curl and bind9-host packages on Ubuntu)?

Thank you,

@Bile1970
Copy link

Bile1970 commented Feb 1, 2024

Here is the output for commands:

`root@playlister:~# curl -I https://amp.shazam.com/
HTTP/2 200
date: Thu, 01 Feb 2024 12:37:44 GMT
content-length: 0
x-shazam-location: ew4
x-forensic-id: a6d2452d-e9ca-4008-b6de-47c0e8036979
via: 1.1 google
alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000

root@playlister:~# host amp.shazam.com
amp.shazam.com is an alias for kong-k8s-prod.shz-amp-prod.shazamcloud.com.
kong-k8s-prod.shz-amp-prod.shazamcloud.com has address 34.149.250.49`

Thank you,

@stuckintraffic0
Copy link
Author

Hello @marin-m
curl output:

HTTP/2 200 
date: Thu, 01 Feb 2024 12:57:35 GMT
content-length: 0
x-shazam-location: ew4
x-forensic-id: bb9daf9c-10c9-4624-9282-ef75c0f2ec0c
via: 1.1 google
alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000

host output:

amp.shazam.com is an alias for kong-k8s-prod.shz-amp-prod.shazamcloud.com.
kong-k8s-prod.shz-amp-prod.shazamcloud.com has address 34.149.250.49

@marin-m
Copy link
Owner

marin-m commented Feb 1, 2024

Thank you,

Does the issue occur both with the GUI and the command line/permanently?

Are you using the distribution from the PPA/the rust source or Flatpak? (The CLI is not guaranteed to work witk Flatpak)

Are you using a container or firewall system of any kind?

It may be required to use a network capture analysis tool such as Wireshark (or a system debugging tool such as strace) to understand the issue if there is persistent difference of functionment between songrec and curl.

@stuckintraffic0
Copy link
Author

stuckintraffic0 commented Feb 1, 2024

Does the issue occur both with the GUI and the command line/permanently?

didn't test GUI, only CLI

Are you using the distribution from the PPA/the rust source or Flatpak? (The CLI is not guaranteed to work witk Flatpak)

using cargo install command, PPA doesn't seem to work

Are you using a container or firewall system of any kind?

I am using this library in docker container, and also behind firewall

@stuckintraffic0
Copy link
Author

It may be required to use a network capture analysis tool such as Wireshark (or a system debugging tool such as strace) to understand the issue if there is persistent difference of functionment between songrec and curl.

you think it's firewall issue? But it was working just fine

@marin-m
Copy link
Owner

marin-m commented Feb 1, 2024

I am using this library in docker container, and also behind firewall

In any case I think you should check the configuration of your container/firewall to ensure that the access to amp.shazam.com on port 443 + resolving the domain is authorized. (Also this is infrastructure controlled by Apple, if you are doing bulk recognition of any kind you don't have guarantee that the tool keeps working)

@stuckintraffic0
Copy link
Author

Thank you. Appreciate your help. Let me test it

@stuckintraffic0
Copy link
Author

okay, disabling firewall (ufw) didn't make any difference so far

@stuckintraffic0
Copy link
Author

Also this is infrastructure controlled by Apple, if you are doing bulk recognition of any kind you don't have guarantee that the tool keeps working

How can we use proxies?

@stuckintraffic0
Copy link
Author

proxychains works

@stuckintraffic0
Copy link
Author

okay, now it doesn't work. Says the same thing

@simon816
Copy link

I started getting this too.

The audio-file-to-recognised-song commands worked:

$ songrec audio-file-to-recognized-song Better\ Off\ Alone.opus 
...
    "subtitle": "Alice Deejay",
    "title": "Better Off Alone",
...

while recognize didn't:

$ songrec recognize Better\ Off\ Alone.opus 
Error: Network unreachable

I then started poking around the code, I ended up compiling it with one crucial change:

diff --git a/src/core/http_thread.rs b/src/core/http_thread.rs
index fe8910b..557174a 100644
--- a/src/core/http_thread.rs
+++ b/src/core/http_thread.rs
@@ -91,6 +91,7 @@ pub fn http_thread(http_rx: mpsc::Receiver<HTTPMessage>, gui_tx: glib::Sender<GU
                                 gui_tx.send(GUIMessage::NetworkStatus(true)).unwrap();
                             }
                             _ => {
+                                gui_tx.send(GUIMessage::ErrorMessage(error.to_string())).unwrap();
                                 gui_tx.send(GUIMessage::NetworkStatus(false)).unwrap();
                             }
                         }

Now we can see what the error is:

$ target/release/songrec recognize Better\ Off\ Alone.opus 
Error: error sending request for url (https://is1-ssl.mzstatic.com/image/thumb/Music112/v4/e4/fe/72/e4fe72dc-453e-0ec4-ddfa-f797375c1bd2/22UMGIM63672.rgb.jpg/400x400cc.jpg): error trying to connect: tcp connect error: Connection refused (os error 111)

Ah! It had been pi-hole'd

$ host is1-ssl.mzstatic.com
is1-ssl.mzstatic.com has address 0.0.0.0
is1-ssl.mzstatic.com has IPv6 address ::

Indeed this was a mistaken block AdguardTeam/AdguardFilters@3892bd6

So perhaps two takeaways:

  • Don't fail recognition if the artwork couldn't be downloaded
  • More verbose logging (perhaps behind a --verbose flag)

@randomscumbag
Copy link

has there been a fix or a work around? I get connections for a few minutes then a disconnect for a long while then it'll reconnect back for a little bit. Not entirely sure if its Just me or a common problem maybe with the servers. It says Shazam servers are not reachable, are you connected? and I am definitely connected.

2024-02-12_23-06

@dotX12
Copy link
Contributor

dotX12 commented Feb 17, 2024

Shazam has introduced a limit on the number of requests, and then sends a 429 error. We also encountered this problem.
shazamio/ShazamIO#81

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants