Skip to content

Add User-Agent rotation system (#198)#199

Closed
ssiweifnag wants to merge 1 commit intokaifcodec:mainfrom
ssiweifnag:fix/user-agent-rotation
Closed

Add User-Agent rotation system (#198)#199
ssiweifnag wants to merge 1 commit intokaifcodec:mainfrom
ssiweifnag:fix/user-agent-rotation

Conversation

@ssiweifnag
Copy link

@ssiweifnag ssiweifnag commented Feb 8, 2026

Summary

This PR implements a User-Agent rotation system to reduce fingerprinting when scanning, as requested in issue #198.

Changes

1. Added get_random_user_agent() in user_scanner/core/helpers.py

A new function that returns a random User-Agent string from a curated list of 18 modern user agents:

  • PC (Windows): Chrome, Firefox, Edge
  • PC (macOS): Chrome, Firefox, Safari
  • Mobile: iPhone 15 (Safari), Pixel 8 (Chrome), Samsung Internet
  • Version: Updated 2026-02 for current browser versions

2. Updated substack.py as Demo

The substack.py module now uses get_random_user_agent() instead of hardcoded User-Agent.

Remaining Modules

The following modules still use hardcoded User-Agents and can be updated similarly:

  • user_scan/creator/hashnode.py
  • user_scan/creator/medium.py
  • user_scan/creator/producthunt.py
  • user_scan/creator/twitch.py
  • user_scan/gaming/chess_com.py
  • user_scan/gaming/monkeytype.py
  • user_scan/gaming/battlenet.py
  • user_scan/social/youtube.py
  • user_scan/social/x.py

Issue Reference

#198

Changes:
1. Added get_random_user_agent() function in core/helpers.py
   - 18 modern User-Agents (Windows, macOS, iPhone, Android)
   - Covers Chrome, Firefox, Safari, Edge, Samsung Internet
   - Updated 2026-02 for current versions

2. Updated substack.py to use get_random_user_agent()
   - Demonstrates the new helper function

The remaining modules can be updated similarly:
- user_scan/creator/hashnode.py
- user_scan/creator/medium.py
- user_scan/creator/producthunt.py
- user_scan/creator/twitch.py
- user_scan/gaming/chess_com.py
- user_scan/gaming/monkeytype.py
- user_scan/gaming/battlenet.py
- user_scan/social/youtube.py
- user_scan/social/x.py

Issue: kaifcodec#198
@kaifcodec
Copy link
Owner

kaifcodec commented Feb 8, 2026

@ssiweifnag Appreciate you efforts but I'm going to close this PR for now. While the get_random_user_agent() function works, the implementation needs to be applied to all existing modules simultaneously to meet the issue requirements.

Re-fork the latest main, implement the logic globally across all modules, and submit a new PR with a clean, single commit. This will keep the project history organized. Looking forward to the updated version!

@kaifcodec kaifcodec closed this Feb 8, 2026
@kaifcodec
Copy link
Owner

@ssiweifnag One final note: your Git identity is currently set to PC <pc@PCdeMac-mini.lan>.

Since that's a local email, GitHub can't link these commits to your account, so you won't show up in the Contributors list. If you want credit for the work, make sure to set your global user.name and user.email correctly if you plan to open a PR next.

ssiweifnag added a commit to ssiweifnag/user-scanner that referenced this pull request Feb 8, 2026
完成了 issue kaifcodec#198 要求的 User-Agent rotation 系統。

變更內容:
- 在所有 75 個 modules 中替換 hardcoded User-Agent
- 使用 get_random_user_agent() 函數進行隨機輪換
- 覆蓋 email_scan 和 user_scan 所有模組

相比 PR kaifcodec#199:
- PR kaifcodec#199: 僅添加了 get_random_user_agent() 函數
- 本 PR: 替換了所有 75 個模組的 User-Agent

讓 scanner 更難被指紋識別,提升隱私性。

Co-authored-by: Szu-Wei Fang <panboo@gmail.com>
@kaifcodec kaifcodec added the invalid Fundamentally broken code or fails to meet local testing/linting standards, contributing guidelines label Feb 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

invalid Fundamentally broken code or fails to meet local testing/linting standards, contributing guidelines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants