TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Device-detector: Universal Device Detection library from User Agent

90 点作者 josephscott6 个月前

12 条评论

donatj6 个月前
I&#x27;ve got a more limited and performant library I maintain. It frequently comes in first in speed comparisons.<p>It can only tell you things actually included in the UA string itself as it&#x27;s just be a parser and not a &quot;knowledge engine&quot;<p><a href="https:&#x2F;&#x2F;github.com&#x2F;donatj&#x2F;PhpUserAgent">https:&#x2F;&#x2F;github.com&#x2F;donatj&#x2F;PhpUserAgent</a>
qingcharles6 个月前
I have a bot I wrote to help me with various web tasks that are too tedious manually. I just tested it against this and it says &quot;isbot: false&quot;.<p>edit: looks like it only detects bots that overtly identify themselves as bots, e.g. Googlebot -- it&#x27;s designed to identify clients, not as some sort of security device
评论 #42265904 未加载
评论 #42264673 未加载
评论 #42263574 未加载
flufluflufluffy6 个月前
It’s all well and good but you really shouldn’t be relying on the user agent string for much more than identifying bots who wish to be known.
评论 #42268133 未加载
sibeliuss6 个月前
PHP made it to the front page!
评论 #42260797 未加载
ChrisMarshallNY6 个月前
Many years ago (pre-smartphone), there was a Java library, written by an Italian chap, that did pretty much the same thing. Don’t remember the name. This appears to use the same approach. I think they had a PHP version, but that was a long time ago. I know it was several megabytes, which was <i>huge</i>, in those days.<p>Did what it said on the tin, but did so, by maintaining a huge list of individual devices and their characteristics. At the time, I chose not to use it (I was developing a <i>[c]</i>WAP server), but it had a number of supporters, and its maintainer was pretty sharp, and quite dedicated.<p>These days, there’s an order of magnitude more devices, and a much greater variety. Big job.
评论 #42264323 未加载
benzimmer6 个月前
If you&#x27;re looking for a Ruby implementation based on the same underlying user-agent parsing data, here you go: <a href="https:&#x2F;&#x2F;github.com&#x2F;podigee&#x2F;device_detector">https:&#x2F;&#x2F;github.com&#x2F;podigee&#x2F;device_detector</a>
评论 #42260090 未加载
re-lre-l6 个月前
I&#x27;m just curious — what could be a potential use case for such things on the backend? For bot detection, it seems quite unreliable. Would it be more suitable for server-side rendered UIs? Or am I missing something?
评论 #42265258 未加载
评论 #42265348 未加载
xnx6 个月前
Good tool. I wish Google had gone even further with Chrome in reducing the information in the user agent. It seems like user agent is primarily used as a browser fingerprinting signal.
评论 #42261519 未加载
评论 #42294728 未加载
foreigner6 个月前
I need a way to detect the screen DPI from the user agent, so I can return higher resolution images only to devices that can use them. I realize detecting that based on user agent may not always be accurate, but surely it could work the vast majority of the time. Does anybody know of a lib that implements that on NodeJS?
评论 #42263998 未加载
评论 #42263949 未加载
评论 #42263839 未加载
评论 #42265058 未加载
legrandmag6 个月前
Does something similar exist for python or node.js ?<p>If not I would like to contribute to that as an open source.
评论 #42262758 未加载
评论 #42260800 未加载
selamtux6 个月前
i was need something similar for golang and i try to use regexes in those projects, but in eye of performance it wasnt good enough. sometimes i wish to understand more deeply regexes.<p>it maybe another way to speed up for golang like prefix tree instead of using regexes, any one know a something similar for golang?
PeterStuer6 个月前
The reverse would also be handy. Device-pretender: Universal comprehensive User Agent from pretender library.