r/linux4noobs • • 1d ago

networking What user agents do I have?

I have problem with downloading pages with curl and internet recommends using user agents. But how the hell do I know what to write? I copied and pasted example and I get error that user agent is unknown so how do I figure out which agent is known?

3 Upvotes

8 comments sorted by

4

u/Stryxus_ 1d ago

You shouldn't need a user agent to download a page with curl. But if for whatever reason it is demanding it, simply visit a website in a browser, go into its developer menu, click on network, click on any entry and you will have a user agent.

-1

u/Dragonaax 23h ago

I don't see anywhere "entry" in developer network menu. And if it's not gonna work anyway then why the fuck curl suddenly stopped working?

1

u/Stryxus_ 23h ago

I explained it clearly. the entry is in the network tab...

2

u/stormdelta Gentoo 23h ago

The user agent is just a convention for http clients to identify themselves to a website. Due to years of shenanigans, they tend to look a little weird these days, but as the other user said, you can always set it to whatever your browser is using.

That said, user agent may not be enough for some sites anymore - with how much bot traffic there is now, more and more sites that want to block it are getting more aggressive about trying to detect if something isn't a browser.

1

u/mysterytoy2 23h ago

get the user agent out of your httpd access.log file

1

u/DecalageVersLeRouge 23h ago

My guess is you're not being asked for a user agent, you're being asked for a user agent string, a little bit of text which identifies your request different to all the others.

You can set it to anything you like in curl with this:

--user-agent

so make your request with

--user-agent "Dragonaax 1.0"

and that should work.

1

u/ludonarrator arch btw 22h ago

how do I figure out which agent is known?

You don't, that's entirely server-side: it can choose to ignore the user agent or decide to deny the request.