Today I also researched this latest calculation method, and the previous answers have already expired.
It has added a parameter "datasyncId" related to user login, which only requires searching for "datasyncId" or "DATASYNC ID" on the login page. It needs to take the second parameter for calculation.
datasyncId = "10438XXXXXXXXXXXXXXX2||10510XXXXXXXXXXXXXXX7"
timesec = str(int(time.time()))
SAPISID = "" # from cookies
origin = "https://studio.youtube.com"
hash = datasyncId.split("||")[1] + ' ' + timesec + ' ' + SAPISID + ' ' + origin
SAPISIDHASH = timesec + '_' + hashlib.sha1(hash.encode('utf-8')).digest().hex() + '_u'