import json import random import time import urllib from dataclasses import dataclass import jsonpickle @dataclass class JsDataPojo: # opts: str r3n: int exp8: int # uid: str bci: bool bcl: float bct: str bdt: str dp0: bool ucdv: bool wdifrm: bool iwgl: str ttst: float # ifov: bool hc: int br_oh: int br_ow: int ua: str wbd: bool tagpu: float wdif: bool wdifpnh: int lg: str isb: bool idp: bool crt: int npmtm: bool br_h: int br_w: int isf: bool nddc: int rs_h: int rs_w: int rs_cd: int phe: bool nm: bool jsf: bool pr: int ars_h: int ars_w: int tz: int str_ss: bool str_ls: bool str_idb: bool str_odb: bool plgod: bool plg: int plgne: str plgre: str plgof: str plggt: str pltod: bool hcovdr: bool hcovdr2: bool plovdr: bool plovdr2: bool ftsovdr: bool ftsovdr2: bool lb: bool eva: int lo: bool ts_mtp: int ts_tec: bool ts_tsa: bool vnd: str bid: str mmt: str plu: str hdn: bool awe: bool geb: bool dat: bool med: str aco: str acots: bool acmp: str acmpts: bool acw: str acwts: bool acma: str acmats: bool acaa: str acaats: bool ac3: str ac3ts: bool acf: str acfts: bool acmp4: str acmp4ts: bool acmp3: str acmp3ts: bool acwm: str acwmts: bool ocpt: bool vco: str vcots: bool vch: str vchts: bool vcw: str vcwts: bool vc3: str vc3ts: bool vcmp: str vcmpts: bool vcq: str vcqts: bool vc1: str vc1ts: bool dvm: int sqt: bool so: str wdw: bool cokys: str ecpc: bool lgs: list lgsod: bool psn: bool edp: bool addt: bool wsdc: bool ccsr: bool nuad: bool bcda: bool idn: bool capi: bool svde: bool vpbq: bool ucdv: bool spwn: bool emt: bool bfr: bool dbov: bool cfpfe: str stcfp: str ckwa: bool glvd: str glrd: str wwl: bool jset: int def __init__(self, glrd, glvd, hc, br_oh, ua, br_ow, br_h, br_w, rs_h, rs_w, rs_cd, ars_h, ars_w, plg, eva, plu, vnd, pr, ts_mtp, dvm, emd, ccsB, br_iw=513, br_ih=847, pf="MacIntel", mob=True, lgs=["fr-FR", "en-US", "zh-CN", "zh", "fr", "en"], orf="debug", bchk="3223aeb6721e0d0917e7928181193ac88dcd62fad5cadfbe7a2b2b473ecf58ee70f098dbdb1a1832e8dc6528387b0745971dbcd82384261e9a4e3f", nt_tcp=0, nt_dns=0, nt_rd=0, nt_irt=-3.400000002235174, nt_rt=0, nt_tls=3.400000002235174, nt_ttf=3.099999997764826, nt_swt=3.400000002235174, nt_csd=0, nt_nhp="", nt_rdc=0, nt_it="navigation", nt_prs=0, nt_esc=-3.400000002235174, nt_ttrd=-2, nt_le=0, nt_dcle=0.10000000149011612, nt_di=74.80000000074506, nt_dc=0, ccsT="""Error at S (https://d.digital.hermes/tags.js:173:22) at Un.C (https://d.digital.hermes/tags.js:1252:41 at nrWrapper (https://www.hermes.com/fr/fr/category/femme/Sacs%20et%20pochettes%20pour%20Femme%20_%20Herme%CC%80s%20France.html:7:13468)""", ccsH="1050544242", ccsV=",993b46baf0942a343b7e6b02fa3f8eef64727f077d3b0055af56e6994dcaf046", muev=False, prso=True, nhi=",64,true,Nexus 5,Android,6.0,138.0.7204.184,false", k_lyts=48, k_lytk="kg20va`l§'w8mh.71pdfoqcn[zy365x/\,-4bt9siu=j;r]e", tzp="Europe/Paris", isf2=False ): # self.opts = "endpoint,ajaxListenerPath" self.nddc = 1 self.r3n = 33 self.exp8 = 0 self.uid = None self.bci = True # batteryManager.charging self.bcl = 0.8 # batteryManager.level self.bct = "Infinity" # batteryManager.chargingTime #to check self.bdt = "Infinity" # batteryManager.chargingTime #to check self.dp0 = False self.ucdv = False self.wdifrm = False self.iwgl = "undefined" # to check self.npmtm = False self.wdif = False self.wdifpnh = 2800984568 self.lg = "fr-FR" self.isb = False # is brave self.idp = True self.crt = 0 self.vnd = vnd self.bid = "NA" self.med = "defined" self.pltod = False self.csssp = "" self.awe = False self.phe = False self.dat = False self.nm = False self.geb = False self.sqt = False self.pf = pf self.hc = hc self.br_oh = br_oh self.br_ow = br_ow self.ua = ua self.wbd = False self.ts_mtp = ts_mtp self.mob = mob self.lgs = lgs self.dvm = dvm self.hcovdr = False self.plovdr = False self.ftsovdr = False self.orf = orf # to check self.ttst = round(random.random(), 16) self.br_w = br_w self.br_h = br_h self.br_iw = br_iw self.br_ih = br_ih self.ars_w = ars_w self.ars_h = ars_h self.rs_w = rs_w self.rs_h = rs_h self.rs_cd = rs_cd self.pr = pr self.so = "portrait-primary" self.vco = "" self.vcots = False self.vch = "probably" self.vchts = True self.vcw = "probably" self.vcwts = True self.vc3 = "maybe" self.vc3ts = False self.vcmp = "" self.vcmpts = False self.vcq = "" self.vcqts = False self.vc1 = "probably" self.vc1ts = True self.cssS = "3.93,0.39,12.24,9.75,5.64,10.98,13.46,2.19,6.51" self.css0 = "7, 75, 0" self.css1 = "9.74354, 0.354646, -0.00922698, 0.000685511, 0.203723, -5.61673, -0.755238, 0.0561098, -0.0279023, 0.481607, -10.9534, 0.813777, -0.375565, 6.48243, -147.433, 11.9534" self.cssH = "15px" self.plu = str.join(",", plu) if isinstance(plu, list) else plu self.plgod = False self.plg = plg self.plgne = "NA" self.plgre = "NA" self.plgof = "NA" self.plggt = "NA" self.mmt = "empty" self.bchk = bchk self.nt_tcp = nt_tcp self.nt_dns = nt_dns self.nt_rd = nt_rd self.nt_irt = nt_irt self.nt_rt = nt_rt self.nt_tls = nt_tls self.nt_ttf = nt_ttf self.nt_swt = nt_swt self.nt_csd = nt_csd self.nt_nhp = nt_nhp self.nt_rdc = nt_rdc self.nt_it = nt_it self.nt_prs = nt_prs self.nt_esc = nt_esc self.nt_ttrd = nt_ttrd self.nt_le = nt_le self.nt_dcle = nt_dcle self.nt_di = nt_di self.nt_dc = nt_dc self.ccsT = ccsT self.ccsB = ccsB self.ccsH = ccsH self.ccsV = ccsV self.muev = muev self.pro_t = True self.wglo = True self.prso = prso self.wbst = True self.psn = True self.edp = True self.addt = True self.wsdc = True self.ccsr = True self.nuad = True self.bcda = True self.idn = True self.capi = True self.svde = True self.vpbq = True self.mq = "aptr:coarse, ahvr:none" # to check self.aco = "probably" self.acots = False self.acmp = "probably" self.acmpts = True self.acw = "probably" self.acwts = False self.acma = "maybe" self.acmats = False self.acaa = "probably" self.acaats = True self.ac3 = "" self.ac3ts = False self.acf = "probably" self.acfts = False self.acmp4 = "maybe" self.acmp4ts = False self.acmp3 = "probably" self.acmp3ts = False self.acwm = "maybe" self.acwmts = False self.ocpt = False self.ckwa = False self.spwn = False self.emt = False self.bfr = False self.tz = -120 self.hdn = False self.xt1 = False # pdfViewerEnabled self.cdhf = False # window.hasFocus() self.eva = eva self.cokys = ",loadTimes,csi,app" self.ecpc = False self.nhi = nhi self.k_lyts = k_lyts self.k_lytk = k_lytk self.emd = emd self.wwl = False self.glvd = glvd self.glrd = glrd self.tzp = tzp self.isf = True self.isf2 = isf2 self.dt = False self.fph = 416468867 # self.ifov = False # tag_pu = random.uniform(1, 10) # while len(str(tag_pu)) != 17: # tag_pu = random.uniform(1, 10) # self.tagpu = tag_pu # self.jsf = False # self.str_ss = True # self.str_ls = True # self.str_idb = True # self.str_odb = True # # # self.hcovdr2 = False # # self.plovdr2 = False # # self.ftsovdr2 = False # self.lb = False # self.lo = False # self.ts_tec = True # self.ts_tsa = True # self.set_default_values() self.jset = int(time.time()) def set_default_values(self): self.sqt = False self.so = "portrait-primary" self.wdw = True self.lgs = ["fr-FR", "en-US", "zh-CN", "zh", "fr", "en"] self.lgsod = False self.psn = True self.edp = False self.addt = True self.wsdc = True self.ccsr = True self.nuad = True self.bcda = True self.idn = True self.capi = False self.svde = False self.vpbq = True self.ucdv = False self.dbov = False self.cfpfe = "ZnVuY3Rpb24oKXt2YXIgbj10LGk9ZG9jdW1lbnRbJ1x4NzFceDc1XHg2NVx4NzJceDc5XHg1M1x4NjVceDZjXHg2NVx4NjNceDc0XHg2Zlx4NzInXShuKDQ2MSkpO2lmKGkpeyFmdW5jdGlvbiB0KCl7dHJ5e3ZhciBuPWlbJ1x4NzNceDY4XHg2MVx4NjRceDZmXHg3" # 4.40.0 self.stcfp = "Ly9kLmRpZ2l0YWwuaGVybWVzL3RhZ3MuanM6Mjo4ODYzNSkKICAgIGF0IHQuZXhwb3J0cy5kZF9hZCAoaHR0cHM6Ly9kLmRpZ2l0YWwuaGVybWVzL3RhZ3MuanM6MjoxMDc3OTYpCiAgICBhdCBodHRwczovL2QuZGlnaXRhbC5oZXJtZXMvdGFncy5qczoyOjYzNzkw" # 4.40.0 def to_url_encoded_json(self): js_str = jsonpickle.encode(self, unpicklable=False).replace(": ", ":").replace(", ", ",") # _safe_string = urllib.parse.quote(js_str) return js_str test_data_json = """{"glvd":"Google Inc. (ARM)","glrd":"ANGLE (ARM, Mali-G57 MC2, OpenGL ES 3.2)","hc":8,"br_oh":745,"br_ow":393, "br_h":745,"br_w":393,"rs_h":876,"rs_w":393,"rs_cd":24,"ars_h":876,"ars_w":393,"plg":0,"eva":33, "vnd":"Google Inc.","plu":[],"ua":"Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Mobile Safari/537.36","dvm":4,"acw":"probably", "pr":2.75,"ts_mtp":5,"tz":-120,"emd":"k:ai,vi,ao", "cookiesStr":"rskxRunCookie=0;datadome=GIfiRxEgyr5dwsnV0NoR9WPO3oA0CkMVLsqdvZLmuxHi81JFRbG7LaWKiAkSQRJTBkv3qBkGlCOC3uR00yZ9XSoCQFyE~1FcumXV8W_bgVPxfNzs6uQcZM8Ec61Q72UT;correlation_id=xlvzlpuwkh6syuqdfze05q7n41qle27qop4yjjvuifzapdo4npjlbi43uwbgle2m;ECOM_SESS=f2c2aihm0ocesmvx3dcs06ysh6;rCookie=0f3nn11uqq28ci5bqnveg5wme4bsr6e;lastRskxRun=1754748244881;x-xsrf-token=7ca984dc-6d35-4720-b77b-465392521d1b;__cf_bm=Szm2hZl9.PTO_DQF5DihrAOTq.dSmSrkKHsTqVenUxo-1754748237-1.0.1.1-gfLAB1wWYyHUb_scXGpXzAk6IkrkhvdNalhhsVhujY7xeFm02lwFKGUiTrBknONdwmvV3EKilTfiFORmJUDrjj3st4hoNdnrk0MT0SVed5w;OptanonConsent=isGpcEnabled=0&datestamp=Sat+Aug+09+2025+16%3A04%3A04+GMT%2B0200+(heure+d%E2%80%99%C3%A9t%C3%A9+d%E2%80%99Europe+centrale)&version=6.32.0&isIABGlobal=false&hosts=&landingPath=https%3A%2F%2Fwww.hermes.com%2Ffr%2Ffr%2Fproduct%2Fsac-p-tit-arcon-H085871CKAO%2F&groups=C0001%3A1%2CC0002%3A0%2CC0003%3A0%2CC0004%3A0;","model":"22041219PG", "lgs":"[fr-FR,fr,en-US,en]", "bchk":"3223aeb6721e0d0917e792818d193ac88dcd62fad5cad7bf7a2b2b473ecf58ee60f018dbdb1a5832e8dc6528387b0745971dbcd82387261e9a4e3f", "nt_tcp":0,"nt_dns":0,"nt_rd":0,"nt_irt":-29.600000008940697,"nt_rt":1129,"nt_tls":6.700000002980232,"nt_ttf":1166.7000000029802,"nt_swt":22.900000005960464, "nt_csd":411060,"nt_nhp":"h2","nt_rdc":0,"nt_it":"navigation","nt_prs":6.700000002980232,"nt_esc":0,"nt_ttrd":null,"nt_le":3.0999999940395355,"nt_dcle":141.79999999701977, "nt_di":1415.2000000029802,"nt_dc":2862.6000000089407,"ccsB":"tags.js:1252:41 at nrWrapper (sac-p-tit-arcon-H085871CKAO.html:7:13468)", "muev":false,"pro_t":false,"nhi":",,true,22041219PG,Android,14.0.0,128.0.6613.146,false","k_lyts":0,"k_lytk":"","serial":"fuljaueqguugf6pn"}""" if __name__ == '__main__': test_data_dict = json.loads(test_data_json) js = JsDataPojo(glrd=test_data_dict['glrd'], glvd=test_data_dict['glvd'], hc=test_data_dict['hc'], ua=test_data_dict['ua'], br_oh=test_data_dict['br_oh'], br_ow=test_data_dict['br_ow'], ars_h=test_data_dict['ars_h'], ars_w=test_data_dict['ars_w'], pr=test_data_dict['pr'], plg=test_data_dict['plg'], br_h=test_data_dict['br_h'], br_w=test_data_dict['br_w'], plu=test_data_dict['plu'], vnd=test_data_dict['vnd'], dvm=test_data_dict['dvm'], ts_mtp=test_data_dict['ts_mtp'], eva=test_data_dict['eva'], rs_h=test_data_dict['rs_h'], rs_w=test_data_dict['rs_w'], rs_cd=test_data_dict['rs_cd'], emd=test_data_dict['emd'], bchk=test_data_dict['bchk'], ccsB=test_data_dict['ccsB'], nt_tcp=test_data_dict['nt_tcp'], nt_dns=test_data_dict['nt_dns'], nt_rd=test_data_dict['nt_rd'], nt_irt=test_data_dict['nt_irt'], nt_rt=test_data_dict['nt_rt'], nt_tls=test_data_dict['nt_tls'], nt_ttf=test_data_dict['nt_ttf'], nt_swt=test_data_dict['nt_swt'], nt_csd=test_data_dict['nt_csd'], nt_nhp=test_data_dict['nt_nhp'], nt_rdc=test_data_dict['nt_rdc'], nt_it=test_data_dict['nt_it'], nt_prs=test_data_dict['nt_prs'], nt_esc=test_data_dict['nt_esc'], nt_ttrd=test_data_dict['nt_ttrd'], nt_le=test_data_dict['nt_le'], nt_dcle=test_data_dict['nt_dcle'], nt_di=test_data_dict['nt_di'], nt_dc=test_data_dict['nt_dc'], ) print(js.to_url_encoded_json()) # text_file = open("jsdata.txt", "w") # # write string to file # text_file.write(safe_string) # # close file # text_file.close() # print(safe_string) # print(js.__dict__)