Python Curl Output Different From Original Html
I am trying to get HTML body from Spotify web. But after I output it to the file the result is for some reason different from the original HTML (it's a completely different site).
Solution 1:
Spotify recognize that you use unsupported "browser", Curl is not a browser so don't think it will behave like one you will need to "fake" that you use a real browser by adding the right headers, something like:
curl 'https://open.spotify.com/artist/4npEfmQ6YuiwW1GpUmaq3F' \
-X 'GET' \
-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.2 Safari/605.1.15'
Post a Comment for "Python Curl Output Different From Original Html"