vchrome 0.0.13__py3-none-any.whl → 0.0.15__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- vchrome/__init__.py +45 -2
- {vchrome-0.0.13.dist-info → vchrome-0.0.15.dist-info}/METADATA +1 -1
- vchrome-0.0.15.dist-info/RECORD +6 -0
- vchrome-0.0.13.dist-info/RECORD +0 -6
- {vchrome-0.0.13.dist-info → vchrome-0.0.15.dist-info}/WHEEL +0 -0
- {vchrome-0.0.13.dist-info → vchrome-0.0.15.dist-info}/top_level.txt +0 -0
vchrome/__init__.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
__version__ = '0.0.
|
|
1
|
+
__version__ = '0.0.15'
|
|
2
2
|
__author__ = 'v'
|
|
3
3
|
# ----------------------------------------------------------------------------------------------------
|
|
4
4
|
_allowed = {'Chrome'}
|
|
@@ -2016,7 +2016,50 @@ def cdp_client(hostname, port, debug=False):
|
|
|
2016
2016
|
raise Exception('type error must be str/list[str], curr type:'+type(acceptLanguage))
|
|
2017
2017
|
d['acceptLanguage'] = acceptLanguage
|
|
2018
2018
|
if is_lang:
|
|
2019
|
-
|
|
2019
|
+
langs = acceptLanguage.split(',')
|
|
2020
|
+
lang = langs[0]
|
|
2021
|
+
script = ('''
|
|
2022
|
+
!function(){
|
|
2023
|
+
// init_lang_and_langs by vchrome
|
|
2024
|
+
var Np = Object.getPrototypeOf(navigator)
|
|
2025
|
+
var Npf = Np.constructor
|
|
2026
|
+
var Odp = Object.defineProperty
|
|
2027
|
+
function make_good_err_stack() {
|
|
2028
|
+
var F_S_split = Date.call.bind("".split);
|
|
2029
|
+
var F_A_slice = Date.call.bind([].slice);
|
|
2030
|
+
var F_A_concat = Date.call.bind([].concat);
|
|
2031
|
+
var F_A_join = Date.call.bind([].join);
|
|
2032
|
+
var C_enter = String.fromCharCode(10);
|
|
2033
|
+
return function(e, a, b) {
|
|
2034
|
+
var stk = e.stack;
|
|
2035
|
+
var stks = F_S_split(stk, C_enter);
|
|
2036
|
+
if (stks.length >= 4) {
|
|
2037
|
+
stks = F_A_concat(F_A_slice(stks, 0, a), F_A_slice(stks, b))
|
|
2038
|
+
}
|
|
2039
|
+
e.stack = F_A_join(stks, C_enter);
|
|
2040
|
+
return e
|
|
2041
|
+
}
|
|
2042
|
+
}
|
|
2043
|
+
var good_err_stack = make_good_err_stack();
|
|
2044
|
+
function perr(_this){
|
|
2045
|
+
if (!(_this instanceof Npf)){
|
|
2046
|
+
throw good_err_stack(TypeError('Illegal invocation'),1,3)
|
|
2047
|
+
}
|
|
2048
|
+
}
|
|
2049
|
+
function get_language(){ /*{ [native code] }*/;perr(this);return '''+json.dumps(lang)+'''; }
|
|
2050
|
+
function get_languages(){ /*{ [native code] }*/;perr(this);return '''+json.dumps(langs)+'''; }
|
|
2051
|
+
Odp(Np, "language", { get: get_language, configurable: true, enumerable: true });
|
|
2052
|
+
Odp(Np, "languages", { get: get_languages, configurable: true, enumerable: true });
|
|
2053
|
+
}()
|
|
2054
|
+
''')
|
|
2055
|
+
has_lang_script = False
|
|
2056
|
+
for s in self.f._wok_script:
|
|
2057
|
+
if 'init_lang_and_langs by vchrome' in s:
|
|
2058
|
+
has_lang_script = s
|
|
2059
|
+
break
|
|
2060
|
+
if has_lang_script:
|
|
2061
|
+
self.f._wok_script.remove(has_lang_script)
|
|
2062
|
+
self.f._wok_script = [script] + self.f._wok_script
|
|
2020
2063
|
auto_timezone = self.guess_timezone_from_language(lang)
|
|
2021
2064
|
if auto_timezone:
|
|
2022
2065
|
self.f.cdp('Emulation.setTimezoneOverride', {"timezoneId":auto_timezone})
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
v/__init__.py,sha256=7sbAHSk_EElMBcJeHVoXGMmt9bqmci36NWFVRk1sUn4,21
|
|
2
|
+
vchrome/__init__.py,sha256=EgeZ1QoM8rxfgiDvOV3jrA3MWLEYaQPvR180Qq40yKE,217248
|
|
3
|
+
vchrome-0.0.15.dist-info/METADATA,sha256=aDG53nBPZ4YbOfcyUd5-yLlUWkP3AjzAbeKKcLdQ7Mk,55
|
|
4
|
+
vchrome-0.0.15.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
5
|
+
vchrome-0.0.15.dist-info/top_level.txt,sha256=IYbkbnFb2FGoroYj_ZXIitmnJDgYBA29_HmK9BdEUkY,10
|
|
6
|
+
vchrome-0.0.15.dist-info/RECORD,,
|
vchrome-0.0.13.dist-info/RECORD
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
v/__init__.py,sha256=7sbAHSk_EElMBcJeHVoXGMmt9bqmci36NWFVRk1sUn4,21
|
|
2
|
-
vchrome/__init__.py,sha256=_0kCGTstF2x741a6286sP1Bm0Q-1Zim-bWO0AWzymIE,214865
|
|
3
|
-
vchrome-0.0.13.dist-info/METADATA,sha256=H8yukVgwE59eeMe_MVezAemKQUJlXBRWz4HfRUaNl00,55
|
|
4
|
-
vchrome-0.0.13.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
5
|
-
vchrome-0.0.13.dist-info/top_level.txt,sha256=IYbkbnFb2FGoroYj_ZXIitmnJDgYBA29_HmK9BdEUkY,10
|
|
6
|
-
vchrome-0.0.13.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|