-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Addition of random user agent string function #1794
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
Conversation
Can be utilized to masquerade streamlink and python installation to multiple browser possibilities.
Codecov Report
@@ Coverage Diff @@
## master #1794 +/- ##
==========================================
- Coverage 49.95% 49.92% -0.03%
==========================================
Files 232 232
Lines 13843 13852 +9
==========================================
+ Hits 6915 6916 +1
- Misses 6928 6936 +8 |
|
|
||
| def random_agent(): | ||
|
|
||
| import random |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should import modules at the top, unless there is a specific reason not to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lazy imports tend to work faster and since they are needed only locally in the function that why I put them there. This is only example however because the difference will be negligible anyway.
|
I think the idea of having better UA strings is not bad, but I'm not a fan of this particular solution, as it only provides a set of statically generated UAs, which doesn't solve the issue of using Streamlink "anonymously" / "transparently". The current Having something like |
|
@bastimeyer Why add yet another dependency for build or core one when you can add a simple function like this and update manually from time to time. |
|
using random old versions makes you more unique than the latest stable version which is exactly the opposite of what you probably wanted https://github.com/streamlink/streamlink/blob/master/src/streamlink/plugin/api/useragents.py the streamlink useragents should be changed once a month or so, using a dependency is maybe a bit to much for this.
|
|
It might be nice to have a few more choices - but you'd want it to be consistent across requests in the same session. We could randomly assign a default, then plugins can change it as needed. I don't think we'd want to add |
Can be utilized to masquerade streamlink and python installation to multiple browser possibilities.