| 70 | } |
| 71 | |
| 72 | async function getFarmShareCode(cookie: string) { |
| 73 | let {data}: any = await axios.post('https://api.m.jd.com/client.action?functionId=initForFarm', `body=${encodeURIComponent(JSON.stringify({"version": 4}))}&appid=wh5&clientVersion=9.1.0`, { |
| 74 | headers: { |
| 75 | "cookie": cookie, |
| 76 | "origin": "https://home.m.jd.com", |
| 77 | "referer": "https://home.m.jd.com/myJd/newhome.action", |
| 78 | "User-Agent": USER_AGENT, |
| 79 | "Content-Type": "application/x-www-form-urlencoded" |
| 80 | } |
| 81 | }) |
| 82 | |
| 83 | if (data.farmUserPro) |
| 84 | return data.farmUserPro.shareCode |
| 85 | else |
| 86 | return '' |
| 87 | } |
| 88 | |
| 89 | async function getCookie(): Promise<string[]> { |
| 90 | let cookiesArr: string[] = [] |