Detect dead links (404 Errors)


I have the following problem when using the Spotify Node to fetch the audio preview URLs. Some of them are playing a 30 second audio snippet and others are dead links where this snippet is not available.

Example-Link with audio:

Example-Link without audio:

What I need to do is to detect the dead links and exchange them with a different link. I tried it already with the “HTTP Request” Node with using “Options → Full Response” but the problem is that in case of a “StatusCodeError: 404 - undefined” the whole node has an error and does not return any data.

I also thought if there might be some other possibility to do it in a function because it seems that crawling through hundreds of links with the “HTTP Request” Node might be quiet slow in the end because it reads a lot of data where i only need to check if the link exists or not.

Thanks in advance for help

You are on a good way. Next to setting “Full Response” you also have to set “Ignore Response Code”. It should then work as expected.

1 Like