From 6ebb37aa17c9e0c95a7596aa4d4bca5808e033bc Mon Sep 17 00:00:00 2001 From: Lamar Pavel Date: Tue, 20 Oct 2015 02:52:11 +0200 Subject: [PATCH 1/7] Update UA list and add script to fetch UAs The script is based on a gist posted by @averrin and has been modified to print the output according to the format expected by qutebrowser, ready to be pasted into configtypes.py. --- qutebrowser/config/configtypes.py | 75 ++++++++++++++++--------------- scripts/ua_fetch.py | 20 +++++++++ 2 files changed, 59 insertions(+), 36 deletions(-) create mode 100644 scripts/ua_fetch.py diff --git a/qutebrowser/config/configtypes.py b/qutebrowser/config/configtypes.py index 86e500f1e..698a289b7 100644 --- a/qutebrowser/config/configtypes.py +++ b/qutebrowser/config/configtypes.py @@ -1558,49 +1558,52 @@ class UserAgent(BaseType): def validate(self, value): self._basic_validation(value) + # To update the following list of user agents, run the script 'ua_fetch.py'. + # Vim-protip: Place your cursor below this comment and run + # :r!python scripts/ua_fetch.py def complete(self): """Complete a list of common user agents.""" out = [ - ('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:35.0) Gecko/20100101 ' - 'Firefox/35.0', - "Firefox 35.0 Win7 64-bit"), - ('Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:35.0) Gecko/20100101 ' - 'Firefox/35.0', - "Firefox 35.0 Ubuntu"), - ('Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:35.0) ' - 'Gecko/20100101 Firefox/35.0', - "Firefox 35.0 MacOSX"), - - ('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) ' - 'AppleWebKit/600.3.18 (KHTML, like Gecko) Version/8.0.3 ' - 'Safari/600.3.18', - "Safari 8.0 MacOSX"), - ('Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, ' - 'like Gecko) Chrome/40.0.2214.111 Safari/537.36', - "Chrome 40.0 Win7 64-bit"), - ('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) ' - 'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.111 ' + 'like Gecko) Chrome/45.0.2454.101 Safari/537.36', + "Chrome 45.0 Win7 64-bit"), + ('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) ' + 'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 ' 'Safari/537.36', - "Chrome 40.0 MacOSX"), - ('Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 ' - '(KHTML, like Gecko) Chrome/40.0.2214.111 Safari/537.36', - "Chrome 40.0 Linux"), - + "Chrome 45.0 MacOSX"), + ('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) ' + 'AppleWebKit/600.8.9 (KHTML, like Gecko) Version/8.0.8 ' + 'Safari/600.8.9', + "Safari 8.0 MacOSX"), + ('Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, ' + 'like Gecko) Chrome/45.0.2454.101 Safari/537.36', + "Chrome 45.0 Win10 64-bit"), + ('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:41.0) Gecko/20100101 ' + 'Firefox/41.0', + "Firefox 41.0 Win7 64-bit"), + ('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11) ' + 'AppleWebKit/601.1.56 (KHTML, like Gecko) Version/9.0 ' + 'Safari/601.1.56', + "Safari Generic MacOSX"), + ('Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, ' + 'like Gecko) Chrome/45.0.2454.101 Safari/537.36', + "Chrome 45.0 Win8.1 64-bit"), + ('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 ' + 'Firefox/40.0', + "Firefox 40.0 Win7 64-bit"), ('Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like ' 'Gecko', - "IE 11.0 Win7 64-bit"), - - ('Mozilla/5.0 (iPhone; CPU iPhone OS 8_1_2 like Mac OS X) ' - 'AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 ' - 'Mobile/12B440 Safari/600.1.4', - "Mobile Safari 8.0 iOS"), - ('Mozilla/5.0 (Android; Mobile; rv:35.0) Gecko/35.0 Firefox/35.0', - "Firefox 35, Android"), - ('Mozilla/5.0 (Linux; Android 5.0.2; One Build/KTU84L.H4) ' - 'AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 ' - 'Chrome/37.0.0.0 Mobile Safari/537.36', - "Android Browser"), + "IE 11.0 for Desktop Win7 64-bit"), + ('Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, ' + 'like Gecko) Chrome/45.0.2454.93 Safari/537.36', + "Chrome 45.0 Win7 64-bit"), + ('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_0) ' + 'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 ' + 'Safari/537.36', + "Chrome 45.0 MacOSX"), + ('Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, ' + 'like Gecko) Chrome/45.0.2454.99 Safari/537.36', + "Chrome 45.0 Win7 64-bit"), ('Mozilla/5.0 (compatible; Googlebot/2.1; ' '+http://www.google.com/bot.html', diff --git a/scripts/ua_fetch.py b/scripts/ua_fetch.py new file mode 100644 index 000000000..a9e39b40a --- /dev/null +++ b/scripts/ua_fetch.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python3 + +import requests +from lxml import html + +url = 'https://techblog.willshouse.com/2012/01/03/most-common-user-agents/' +page = requests.get(url) +page = html.fromstring(page.text) +path = '//*[@id="post-2229"]/div[2]/table/tbody' +table = page.xpath(path)[0] + +indent = " " +print("%sdef complete(self):" % indent) +print("%s\"\"\"Complete a list of common user agents.\"\"\"" % (2 * indent)) +print("%sout = [" % (2 * indent)) +for row in table[:12]: + ua = row[1].text_content() + browser = row[2].text_content() + print("%s(\'%s\',\n%s \"%s\")," % (3 * indent, ua, 3 * indent, browser)) +print("%s]\n%sreturn out\n" % (2 * indent, 2 * indent)) From 332df99a7725cb97018bb4baadcda5645f4f3f5c Mon Sep 17 00:00:00 2001 From: Lamar Pavel Date: Tue, 20 Oct 2015 03:28:27 +0200 Subject: [PATCH 2/7] Add docstring to new script --- scripts/ua_fetch.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/ua_fetch.py b/scripts/ua_fetch.py index a9e39b40a..9f3ab785e 100644 --- a/scripts/ua_fetch.py +++ b/scripts/ua_fetch.py @@ -1,4 +1,11 @@ #!/usr/bin/env python3 +# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: + +"""Fetch list of popular user-agents. + +The script is based on a gist posted by github.com/averrin, the ouput of this +script is formatted to be pasted into configtypes.py. +""" import requests from lxml import html From 7703fa217b051df93a15690c8d8f8ed95ddaec18 Mon Sep 17 00:00:00 2001 From: Lamar Pavel Date: Tue, 20 Oct 2015 17:28:22 +0200 Subject: [PATCH 3/7] Add some UAs manually for diversity The automatically fetched list includes popular user-agents but does not guarantee any kind of diversity, so there are now a few statically printed UAs from mobile browsers. --- qutebrowser/config/configtypes.py | 2 +- scripts/dev/ua_fetch.py | 61 +++++++++++++++++++++++++++++++ scripts/ua_fetch.py | 27 -------------- 3 files changed, 62 insertions(+), 28 deletions(-) create mode 100644 scripts/dev/ua_fetch.py delete mode 100644 scripts/ua_fetch.py diff --git a/qutebrowser/config/configtypes.py b/qutebrowser/config/configtypes.py index 698a289b7..0c3d9dde2 100644 --- a/qutebrowser/config/configtypes.py +++ b/qutebrowser/config/configtypes.py @@ -1560,7 +1560,7 @@ class UserAgent(BaseType): # To update the following list of user agents, run the script 'ua_fetch.py'. # Vim-protip: Place your cursor below this comment and run - # :r!python scripts/ua_fetch.py + # :r!python scripts/dev/ua_fetch.py def complete(self): """Complete a list of common user agents.""" out = [ diff --git a/scripts/dev/ua_fetch.py b/scripts/dev/ua_fetch.py new file mode 100644 index 000000000..26aba6d10 --- /dev/null +++ b/scripts/dev/ua_fetch.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python3 +# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: + +# Copyright 2015 lamarpavel +# Copyright 2015 Alexey Nabrodov (Averrin) +# +# This file is part of qutebrowser. +# +# qutebrowser is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# qutebrowser is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with qutebrowser. If not, see . + + +"""Fetch list of popular user-agents. + +The script is based on a gist posted by github.com/averrin, the ouput of this +script is formatted to be pasted into configtypes.py. +""" + +import requests +from lxml import html # pylint: disable=import-error + +# Fetch list of popular user-agents and store the relevant strings +url = 'https://techblog.willshouse.com/2012/01/03/most-common-user-agents/' +page = requests.get(url) +page = html.fromstring(page.text) +path = '//*[@id="post-2229"]/div[2]/table/tbody' +table = page.xpath(path)[0] +indent = " " + +# Print function defition followed by an automatically fetched list of popular +# user agents and a few additional entries for diversity. +print("%sdef complete(self):" % indent) +print("%s\"\"\"Complete a list of common user agents.\"\"\"" % (2 * indent)) +print("%sout = [" % (2 * indent)) +for row in table[:12]: + ua = row[1].text_content() + browser = row[2].text_content() + print("%s(\'%s\',\n%s \"%s\")," % (3 * indent, ua, 3 * indent, browser)) +print(""" + ('Mozilla/5.0 (iPhone; CPU iPhone OS 8_1_2 like Mac OS X) ' + 'AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 ' + 'Mobile/12B440 Safari/600.1.4', + "Mobile Safari 8.0 iOS"), + ('Mozilla/5.0 (Android; Mobile; rv:35.0) Gecko/35.0 Firefox/35.0', + "Firefox 35, Android"), + ('Mozilla/5.0 (Linux; Android 5.0.2; One Build/KTU84L.H4) ' + 'AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 ' + 'Chrome/37.0.0.0 Mobile Safari/537.36', + "Android Browser") +""") +print("%s]\n%sreturn out\n" % (2 * indent, 2 * indent)) diff --git a/scripts/ua_fetch.py b/scripts/ua_fetch.py deleted file mode 100644 index 9f3ab785e..000000000 --- a/scripts/ua_fetch.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env python3 -# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: - -"""Fetch list of popular user-agents. - -The script is based on a gist posted by github.com/averrin, the ouput of this -script is formatted to be pasted into configtypes.py. -""" - -import requests -from lxml import html - -url = 'https://techblog.willshouse.com/2012/01/03/most-common-user-agents/' -page = requests.get(url) -page = html.fromstring(page.text) -path = '//*[@id="post-2229"]/div[2]/table/tbody' -table = page.xpath(path)[0] - -indent = " " -print("%sdef complete(self):" % indent) -print("%s\"\"\"Complete a list of common user agents.\"\"\"" % (2 * indent)) -print("%sout = [" % (2 * indent)) -for row in table[:12]: - ua = row[1].text_content() - browser = row[2].text_content() - print("%s(\'%s\',\n%s \"%s\")," % (3 * indent, ua, 3 * indent, browser)) -print("%s]\n%sreturn out\n" % (2 * indent, 2 * indent)) From 08bbb6b7c7bf2b5eba8563791b8449e2d00d66e9 Mon Sep 17 00:00:00 2001 From: Lamar Pavel Date: Tue, 20 Oct 2015 17:30:39 +0200 Subject: [PATCH 4/7] Consider new UA script in tox tests To avoid failing tests tox now includes one of the modules required by the script and the latter informs pylint to ignore one of the imports. --- tox.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/tox.ini b/tox.ini index cbe077b75..6c4d349d1 100644 --- a/tox.ini +++ b/tox.ini @@ -96,6 +96,7 @@ deps = logilab-common==1.1.0 six==1.10.0 vulture==0.8.1 + requests==2.8.1 commands = {envpython} scripts/link_pyqt.py --tox {envdir} {envpython} -m pylint scripts qutebrowser --rcfile=.pylintrc --output-format=colorized --reports=no --expected-line-ending-format=LF From 45f9e61815bb6691e5c326cc3cb22f831abc3f3f Mon Sep 17 00:00:00 2001 From: Lamar Pavel Date: Tue, 20 Oct 2015 18:17:12 +0200 Subject: [PATCH 5/7] Fix pylint error (line too long) --- qutebrowser/config/configtypes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qutebrowser/config/configtypes.py b/qutebrowser/config/configtypes.py index 0c3d9dde2..6d3b4813e 100644 --- a/qutebrowser/config/configtypes.py +++ b/qutebrowser/config/configtypes.py @@ -1558,7 +1558,7 @@ class UserAgent(BaseType): def validate(self, value): self._basic_validation(value) - # To update the following list of user agents, run the script 'ua_fetch.py'. + # To update the following list of user agents, run the script 'ua_fetch.py' # Vim-protip: Place your cursor below this comment and run # :r!python scripts/dev/ua_fetch.py def complete(self): From d74581971525d37555f42649f8c4f48b8fbda840 Mon Sep 17 00:00:00 2001 From: Lamar Pavel Date: Sat, 14 Nov 2015 15:57:24 +0100 Subject: [PATCH 6/7] Improve script to print entries grouped by browser The ua_fetch.py has been re-written entirely to find specific entries for each browser based on diversity rather than sole popularity. The output is now formatted to print the entries for each browser grouped together. --- qutebrowser/config/configtypes.py | 37 ++++++----- scripts/dev/ua_fetch.py | 106 ++++++++++++++++++++++-------- 2 files changed, 97 insertions(+), 46 deletions(-) diff --git a/qutebrowser/config/configtypes.py b/qutebrowser/config/configtypes.py index 6d3b4813e..c73330897 100644 --- a/qutebrowser/config/configtypes.py +++ b/qutebrowser/config/configtypes.py @@ -1564,6 +1564,22 @@ class UserAgent(BaseType): def complete(self): """Complete a list of common user agents.""" out = [ + ('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:41.0) Gecko/20100101 ' + 'Firefox/41.0', + "Firefox 41.0 Win7 64-bit"), + ('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 ' + 'Firefox/40.0', + "Firefox 40.0 Win7 64-bit"), + + ('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) ' + 'AppleWebKit/600.8.9 (KHTML, like Gecko) Version/8.0.8 ' + 'Safari/600.8.9', + "Safari 8.0 MacOSX"), + ('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11) ' + 'AppleWebKit/601.1.56 (KHTML, like Gecko) Version/9.0 ' + 'Safari/601.1.56', + "Safari Generic MacOSX"), + ('Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, ' 'like Gecko) Chrome/45.0.2454.101 Safari/537.36', "Chrome 45.0 Win7 64-bit"), @@ -1571,29 +1587,12 @@ class UserAgent(BaseType): 'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 ' 'Safari/537.36', "Chrome 45.0 MacOSX"), - ('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) ' - 'AppleWebKit/600.8.9 (KHTML, like Gecko) Version/8.0.8 ' - 'Safari/600.8.9', - "Safari 8.0 MacOSX"), ('Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, ' 'like Gecko) Chrome/45.0.2454.101 Safari/537.36', "Chrome 45.0 Win10 64-bit"), - ('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:41.0) Gecko/20100101 ' - 'Firefox/41.0', - "Firefox 41.0 Win7 64-bit"), - ('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11) ' - 'AppleWebKit/601.1.56 (KHTML, like Gecko) Version/9.0 ' - 'Safari/601.1.56', - "Safari Generic MacOSX"), ('Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, ' 'like Gecko) Chrome/45.0.2454.101 Safari/537.36', "Chrome 45.0 Win8.1 64-bit"), - ('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 ' - 'Firefox/40.0', - "Firefox 40.0 Win7 64-bit"), - ('Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like ' - 'Gecko', - "IE 11.0 for Desktop Win7 64-bit"), ('Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, ' 'like Gecko) Chrome/45.0.2454.93 Safari/537.36', "Chrome 45.0 Win7 64-bit"), @@ -1605,6 +1604,10 @@ class UserAgent(BaseType): 'like Gecko) Chrome/45.0.2454.99 Safari/537.36', "Chrome 45.0 Win7 64-bit"), + ('Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like ' + 'Gecko', + "IE 11.0 for Desktop Win7 64-bit"), + ('Mozilla/5.0 (compatible; Googlebot/2.1; ' '+http://www.google.com/bot.html', "Google Bot"), diff --git a/scripts/dev/ua_fetch.py b/scripts/dev/ua_fetch.py index 26aba6d10..85df09628 100644 --- a/scripts/dev/ua_fetch.py +++ b/scripts/dev/ua_fetch.py @@ -29,33 +29,81 @@ script is formatted to be pasted into configtypes.py. import requests from lxml import html # pylint: disable=import-error -# Fetch list of popular user-agents and store the relevant strings -url = 'https://techblog.willshouse.com/2012/01/03/most-common-user-agents/' -page = requests.get(url) -page = html.fromstring(page.text) -path = '//*[@id="post-2229"]/div[2]/table/tbody' -table = page.xpath(path)[0] -indent = " " -# Print function defition followed by an automatically fetched list of popular -# user agents and a few additional entries for diversity. -print("%sdef complete(self):" % indent) -print("%s\"\"\"Complete a list of common user agents.\"\"\"" % (2 * indent)) -print("%sout = [" % (2 * indent)) -for row in table[:12]: - ua = row[1].text_content() - browser = row[2].text_content() - print("%s(\'%s\',\n%s \"%s\")," % (3 * indent, ua, 3 * indent, browser)) -print(""" - ('Mozilla/5.0 (iPhone; CPU iPhone OS 8_1_2 like Mac OS X) ' - 'AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 ' - 'Mobile/12B440 Safari/600.1.4', - "Mobile Safari 8.0 iOS"), - ('Mozilla/5.0 (Android; Mobile; rv:35.0) Gecko/35.0 Firefox/35.0', - "Firefox 35, Android"), - ('Mozilla/5.0 (Linux; Android 5.0.2; One Build/KTU84L.H4) ' - 'AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 ' - 'Chrome/37.0.0.0 Mobile Safari/537.36', - "Android Browser") -""") -print("%s]\n%sreturn out\n" % (2 * indent, 2 * indent)) +# Fetch list of popular user-agents and return list of relevant strings +def fetch(): + url = 'https://techblog.willshouse.com/2012/01/03/most-common-user-agents/' + page = requests.get(url) + page = html.fromstring(page.text) + path = '//*[@id="post-2229"]/div[2]/table/tbody' + return page.xpath(path)[0] + + +# Filter the received list based on a look up table. The LUT should be a +# dictionary of the format {browser: versions}, where 'browser' is the name of +# the browser (eg. "Firefox") as string and 'versions' is a set of different +# versions of this browser that should be included when found (eg. {"Linux", +# "MacOSX"}). This function returns a dictionary with the same keys as the +# LUT, but storing lists of tuples (user_agent, browser_description) as values. +def filter_list(complete_list, browsers): + table = {} + for entry in complete_list: + # Tuple of (user_agent, browser_description) + candidate = (entry[1].text_content(), entry[2].text_content()) + for name in browsers: + found = False + if name.lower() in candidate[1].lower(): + for version in browsers[name]: + if version.lower() in candidate[1].lower(): + if table.get(name) is None: + table[name] = [] + table[name].append(candidate) + browsers[name].remove(version) + found = True + break + if found: + break + return table + + +# Insert a few additional entries for diversity into the dict (as returned by +# filter_list()) +def add_diversity(table): + table["Obscure"] = [ + ('Mozilla/5.0 (compatible; Googlebot/2.1; ' + '+http://www.google.com/bot.html', + "Google Bot"), + ('Wget/1.16.1 (linux-gnu)', + "wget 1.16.1"), + ('curl/7.40.0', + "curl 7.40.0") + ] + return table + + +if __name__ == '__main__': + fetched = fetch() + lut = { + "Firefox": {"Win", "MacOSX", "Linux", "Android"}, + "Chrome": {"Win", "MacOSX", "Linux"}, + "Safari": {"MacOSX", "iOS"} + } + filtered = filter_list(fetched, lut) + filtered = add_diversity(filtered) + + tab = " " + print("%sdef complete(self):" % tab) + print("%s\"\"\"Complete a list of common user agents.\"\"\"" % (2 * tab)) + print("%sout = [" %(2 * tab)) + + for browser in ["Firefox", "Safari", "Chrome", "Obscure"]: + for it in filtered[browser]: + print("%s(\'%s\',\n%s \"%s\")," % (3 * tab, it[0], 3 * tab, it[1])) + print("") + + print("""\ + ('Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like ' + 'Gecko', + "IE 11.0 for Desktop Win7 64-bit")""") + + print("%s]\n%sreturn out\n" % (2 * tab, 2 * tab)) From 46d335cdeeeb5513bbe2ad65a911a57d99905f97 Mon Sep 17 00:00:00 2001 From: Lamar Pavel Date: Sat, 14 Nov 2015 16:06:45 +0100 Subject: [PATCH 7/7] Update list of user agents with new script. --- qutebrowser/config/configtypes.py | 60 +++++++++++++------------------ 1 file changed, 25 insertions(+), 35 deletions(-) diff --git a/qutebrowser/config/configtypes.py b/qutebrowser/config/configtypes.py index c73330897..ab6057356 100644 --- a/qutebrowser/config/configtypes.py +++ b/qutebrowser/config/configtypes.py @@ -1567,46 +1567,32 @@ class UserAgent(BaseType): ('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:41.0) Gecko/20100101 ' 'Firefox/41.0', "Firefox 41.0 Win7 64-bit"), - ('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 ' - 'Firefox/40.0', - "Firefox 40.0 Win7 64-bit"), + ('Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:41.0) ' + 'Gecko/20100101 Firefox/41.0', + "Firefox 41.0 MacOSX"), + ('Mozilla/5.0 (X11; Linux x86_64; rv:41.0) Gecko/20100101 ' + 'Firefox/41.0', + "Firefox 41.0 Linux"), - ('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) ' - 'AppleWebKit/600.8.9 (KHTML, like Gecko) Version/8.0.8 ' - 'Safari/600.8.9', - "Safari 8.0 MacOSX"), - ('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11) ' - 'AppleWebKit/601.1.56 (KHTML, like Gecko) Version/9.0 ' - 'Safari/601.1.56', + ('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) ' + 'AppleWebKit/601.2.7 (KHTML, like Gecko) Version/9.0.1 ' + 'Safari/601.2.7', "Safari Generic MacOSX"), + ('Mozilla/5.0 (iPad; CPU OS 9_1 like Mac OS X) ' + 'AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 ' + 'Mobile/13B143 Safari/601.1', + "Mobile Safari Generic iOS"), ('Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, ' - 'like Gecko) Chrome/45.0.2454.101 Safari/537.36', - "Chrome 45.0 Win7 64-bit"), + 'like Gecko) Chrome/46.0.2490.80 Safari/537.36', + "Chrome 46.0 Win7 64-bit"), ('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) ' - 'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 ' + 'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 ' 'Safari/537.36', - "Chrome 45.0 MacOSX"), - ('Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, ' - 'like Gecko) Chrome/45.0.2454.101 Safari/537.36', - "Chrome 45.0 Win10 64-bit"), - ('Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, ' - 'like Gecko) Chrome/45.0.2454.101 Safari/537.36', - "Chrome 45.0 Win8.1 64-bit"), - ('Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, ' - 'like Gecko) Chrome/45.0.2454.93 Safari/537.36', - "Chrome 45.0 Win7 64-bit"), - ('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_0) ' - 'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 ' - 'Safari/537.36', - "Chrome 45.0 MacOSX"), - ('Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, ' - 'like Gecko) Chrome/45.0.2454.99 Safari/537.36', - "Chrome 45.0 Win7 64-bit"), - - ('Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like ' - 'Gecko', - "IE 11.0 for Desktop Win7 64-bit"), + "Chrome 46.0 MacOSX"), + ('Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, ' + 'like Gecko) Chrome/46.0.2490.80 Safari/537.36', + "Chrome 46.0 Linux"), ('Mozilla/5.0 (compatible; Googlebot/2.1; ' '+http://www.google.com/bot.html', @@ -1614,7 +1600,11 @@ class UserAgent(BaseType): ('Wget/1.16.1 (linux-gnu)', "wget 1.16.1"), ('curl/7.40.0', - "curl 7.40.0") + "curl 7.40.0"), + + ('Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like ' + 'Gecko', + "IE 11.0 for Desktop Win7 64-bit") ] return out