抖音web 上传协议,抖音上传

dyweb.jpg

分享一个抖音web登录算法

class Dylogin:
    def __init__(self, phone):
        self.phone = phone
        self.s = requests.Session()
        self.s.headers = {
            'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36',
            'referer': 'https://creator.douyin.com/'
        }

    def __s(self, e):
        t = []
        n = 0
        for x in range(len(e)):
            r = ord(e[x])
            if 0 <= r and r <= 127:
                t.append(r)
            elif 128 <= r and r <= 2047:
                t.append(192 | 31 & r >> 6)
                t.append(128 | 63 & r)
            elif 2048 <= r and r <= 55295 or 57344 <= r and r <= 65535:
                t.append(224 | 15 & r >> 12);
                t.append(128 | 63 & r >> 6);
                t.append(128 | 63 & r)
        for i in range(len(t)):
            t[n] &= 255;
        return t

    def __encrypt(self, e):
        t = 0
        a = []
        if 0 == e:
            return ""
        e += ""
        n = self.__s(e)
        r = len(n)
        for x in range(r):
            if t < r:
                a.append(hex((5 ^ n[t])))
                t += 1
            else:
                break

        return ''.join(a).replace('0x', '')

    def sendSms(self):
        url = 'https://creator.douyin.com/passport/web/send_code/?account_sdk_source=web&mobile=%2B86' + self.phone + '&type=24&aid=2906'
        res = self.s.get(url).json()
        if res['message'] == 'success':
            print('短信发送成功!')
            return True
        else:
            print(res['data']['description'])
            return False

    def login(self, code):
        url = 'https://creator.douyin.com/passport/web/sms_login/?account_sdk_source=web'
        data = {
            'mobile': self.__encrypt('+86' + self.phone),
            'code': self.__encrypt(code),
            'aid': 2906,
            'mix_mode': 1
        }
        res = self.s.post(url, data=data)
        msg = res.json()
        # print(msg)
        # print(res.cookies.get_dict())

        if msg['message'] == 'error':
            print(msg['data']['description'])
            return False
        elif msg['message'] == 'success':
            print('登录成功!')
            print(msg['data']['name'])
            cookies = res.cookies.get_dict()
            return cookies

抖音web 上传协议

下载面板

文件名称:抖音web上传视频 下载声明:网络资源来自网络收集或本人原创,转载请注明出处!若资源侵犯了你的版权,请联繫博主,我们会在24H内删除侵权资源!

-- 展开阅读全文 --
邮大侠– 验证电子邮件地址有效性!
« 上一篇 05-12

发表评论