<?php

namespace app\extra\tools;

use yzh52521\EasyHttp\Http;

class DouyinUserInfo
{

    public function getInfo(string $url = ""): array
    {
        $user = Http::asJson()->post("https://douyin.wtf/api/douyin/web/get_all_sec_user_id",[$url])->array();
        if ($user['code'] <> 200) return [0,'用户信息获取失败'];
        $userData = Http::asJson()->get("https://douyin.wtf/api/douyin/web/handler_user_profile",[
            "sec_user_id" => $user['data'][0]
        ])->array();
        if ($userData['code'] <> 200) return [0,'用户信息获取失败'];
        return [1,$userData['data']];
    }

}