user-agent

What is the standard format for a browser's User-Agent string?

早过忘川 提交于 2019-12-17 17:53:21
问题 Is there an RFC, official standard, or template for creating a User Agent string? The iphone's user-agent string seems strange... Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_1_2 like Mac OS X ; en-us) AppleWebKit/528.18 ( KHTML, like Gecko ) Version/4.0 Mobile/7D11 Safari/528.16 回答1: The User-Agent header is part of the RFC7231, which is an improved version of the RFC1945, where it states: The User-Agent request-header field contains information about the user agent originating the request. This

Scrapy Python Set up User Agent

被刻印的时光 ゝ 提交于 2019-12-17 15:53:42
问题 I tried to override the user-agent of my crawlspider by adding an extra line to the project configuration file. Here is the code: [settings] default = myproject.settings USER_AGENT = "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36" [deploy] #url = http://localhost:6800/ project = myproject But when I run the crawler against my own web, I notice the spider did not pick up my customized user agent but the default one "Scrapy/0.18.2 (

Code to parse user agent string?

大憨熊 提交于 2019-12-17 09:47:21
问题 As strange as I find this, I have not been able to find a good PHP function anywhere which will do an intelligent parse of a user agent string? Googled it for about 20 minutes now. I have the string already, I just need something that will chop it up and give me at least browser/ver/os. Know of a good snippet anywhere? 回答1: The get_browser() function has been available in PHP for quite a long a time. The PHP manual is free, can be downloaded in various formats and viewed online (with comments

What is the purpose of the implicit grant authorization type in OAuth 2?

两盒软妹~` 提交于 2019-12-17 06:19:08
问题 I don't know if I just have some kind of blind spot or what, but I've read the OAuth 2 spec many times over and perused the mailing list archives, and I have yet to find a good explanation of why the Implicit Grant flow for obtaining access tokens has been developed. Compared to the Authorization Code Grant, it seems to just give up on client authentication for no very compelling reason. How is this "optimized for clients implemented in a browser using a scripting language" (to quote the

Change user agent for selenium driver

强颜欢笑 提交于 2019-12-17 04:39:24
问题 I have the following code in Python : from selenium.webdriver import Firefox from contextlib import closing with closing(Firefox()) as browser: browser.get(url) I would like to print the user-agent HTTP header and possibly change it. Is it possible? 回答1: There is no way in Selenium to read the request or response headers. You could do it by instructing your browser to connect through a proxy that records this kind of information. Setting the User Agent in Firefox The usual way to change the

Why do all browsers' user agents start with “Mozilla/”?

ぃ、小莉子 提交于 2019-12-17 03:24:47
问题 All popular browsers' user agent strings, even Internet Explorer's, start with Mozilla/ . Why is this the case? 回答1: It is a long and sad story. In summary: Mozilla browser gets released, with User-Agent Mozilla/1.0 (Win3.1) . It is publicly renamed to Netscape, but in its User-Agent it keeps its original name . Internet Explorer is released. It spoofs Netscape by starting its User-Agent with Mozilla/ because web servers were routinely browser sniffing and serving pages with frames - a

not found: value UADetectorServiceFactory

岁酱吖の 提交于 2019-12-13 19:36:36
问题 On the reference of this question, I try the below code in Scala: import net.sf.uadetector._ def check = Action { implicit request => println(request.headers) var parser = UADetectorServiceFactory.getOnlineUpdatingParser(); println(parser) val agent = parser.parse(request.headers.get("User-Agent").getOrElse("")) println(agent) val which = agent.getUserAgentType(); // this can be ROBOT, BROWSER, etc. println(which) Ok(write(Map("result" -> true))) } and libraryDependencies += "net.sf

User Agent is not accessible in Internet Explorer 8 using ActionScript 3

不羁岁月 提交于 2019-12-13 19:14:28
问题 I am using the code below to find the User Agent using ActionScript 3: var userAgent:String = ExternalInterface.call("navigator.userAgent.toString"); The code is working in Firefox 13, Google Chrome & Opera, but the User Agent value as null in IE8. Is there any code snippet that will work here or any other way to implement this? 回答1: toString is unnecessary, since userAgent is a string property. Use this syntax instead: var userAgent:String = ExternalInterface.call("function(){return

How to click a link within youtube comment using an user agent through Selenium and Python

廉价感情. 提交于 2019-12-13 16:24:34
问题 I am writing a script that clicks a link in the youtube comment, it works fine, but when I combine it with the user agent it doesn't work, can someone help me? example : link Html : <a class="yt-simple-endpoint style-scope yt-formatted-string" spellcheck="false" href="/redirect?redir_token=ix1uBK3TO3bxXdcT7EvDFp-vI9p8MTU0NjQxNTExOEAxNTQ2MzI4NzE4&event=comments&q=https%3A%2F%2Fjulissars.itworks.com%2F&stzid=Ugw6ip_QkzwyJPIq3bp4AaABAg" rel="nofollow">https://julissars.itworks.com</a> Code

Python - Unable to rotate userAgent dynamically in Scrapy

扶醉桌前 提交于 2019-12-13 15:48:05
问题 I am overriding default implemenation of scrapy modules HttpProxyMiddleware and UserAgentMiddleware , and my own implementation of scrapy rotates user-agent and IP address, which picks the values randomly from the list provided. IP is changing for every request but not user-agent. I am unable to figureout the reason. Here is my implementation of classes RotateUserAgentMiddleware class RotateUserAgentMiddleware(UserAgentMiddleware): def __init__(self, user_agent=''): self.user_agent = user