Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for multiple browser user agents #547

Merged
merged 3 commits into from Oct 20, 2020
Merged

Conversation

SesioN
Copy link
Contributor

@SesioN SesioN commented Oct 19, 2020

Description

Added the ability to define a pool of many browser user agents in the environment file.
On each request a random user agent will get used from the defined pool.

The idea is to keep the bot more anonymized and harder to detect by having many user agents instead of just one.

It would be better to have each user agent separated by a line break, but sadly the version of dotenv doesn't support it yet?

Supported in:
https://github.com/bkeepers/dotenv#multi-line-values

But not in:
https://github.com/motdotla/dotenv

Example source for common user agents:
https://developers.whatismybrowser.com/useragents/explore/

NOTICE
Breaking change duo to rename from USER_AGENT to USER_AGENTS in env file!
Maybe this feature could create an additional entry instead of rename or just use old name.

Testing

New dependencies

… on each request to improve the bot anonymity.
@SesioN SesioN requested a review from jef as a code owner October 19, 2020 23:23
When swapping indexOf to includes I forgot to correct the order the conditional ternary operation. Now fixed.
@jef
Copy link
Owner

jef commented Oct 20, 2020

Breaking change duo to rename from USER_AGENT to USER_AGENTS in env file!
Maybe this feature could create an additional entry instead of rename or just use old name.

Perhaps just revert to USER_AGENT. I don't mind having this come in. Other variables are also non-plural.

Copy link
Owner

@jef jef left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert USER_AGENTS to USER_AGENT

Copy link
Owner

@jef jef left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Thanks so much for the work! Cool idea.

@jef jef changed the title feat: Add support for multiple browser user agents feat: add support for multiple browser user agents Oct 20, 2020
@jef jef merged commit 10a81dc into jef:main Oct 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants