Trick Websites to show only desktop version

There are some websites which give us different site for mobile and desktop.
for example “youtube”

for mobile:
for desktop:

Now, my question is how to trick “youtube” or any other website into giving us only the desktop version in js

    .then( res => res.json()
    .then(json => console.log(json);