To change the URL into a CORS proxy URL, you typically add the proxy url before your target URL.
With the popular open source CORS proxy (cors-anywhere):
https://cors-anywhere.herokuapp.com/http://suggestqueries.google.com/complete/search?client=firefox&ds=yt&q=proxy
or alternatively for a hosted CORS Proxy (Corsfix)
https://proxy.corsfix.com/?http://suggestqueries.google.com/complete/search?client=firefox&ds=yt&q=proxy
I want to change this url to cors proxy url (want to bypass cors issue)
In order to bypass the CORS issue, you would use the proxied URL when doing fetch as follows
fetch("https://proxy.corsfix.com/?http://suggestqueries.google.com/complete/search?client=firefox&ds=yt&q=proxy")
.then((response) => response.text())
.then((text) => console.log(text))
Result
["proxy",["proxy","proxy server","proxy parent lucky day","proxy war","proxy for school chromebook 2024","proxy singed","proxy vs reverse proxy","proxy server explained","proxy gate tactician","proxy martin garrix"],[],{"google:suggestsubtypes":[[512,433],[512,433],[512],[512],[512],[512,433],[512],[512],[512,433],[512]]}]
(I am affiliated with Corsfix)