Ad

How To Fetch Metadata (image, Title, Description) From Any Url In ReactJS

- 1 answer

I want to fetch metadata (title, image, description) from a url like a Medium article and then display it as a post on my blog. How to do it. I am using ReactJS

I tried using fetch and axios.get but it always shows error in the browser's console. "NetworkError when attempting to fetch resource." "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://medium.com/s/jessica-valenti/hateful-fox-news-rhetoric-can-do-real-world-harm-52e26008caa5. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing)"

Ad

Answer

Use open-graph-scraper and make the request from backend-server. It works like a delight

Ad
source: stackoverflow.com
Ad