Detect dead links (404 Errors)

Hello,

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:
https://p.scdn.co/mp3-preview/1bb4d96f74479d60ec5de90fbf191be9299f1b51?cid=b0e97f16d6ac43f8874e3ba8379977c6

Example-Link without audio:
https://p.scdn.co/mp3-preview/e9977599b6a33331d0eb59b17a9d93df1a609845?cid=b0e97f16d6ac43f8874e3ba8379977c6

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