ssovit / TikTok-API-PHP

Unofficial TikTok API for PHP. Join our Discord server
https://discord.gg/rSQd2QAXA8
MIT License
145 stars 42 forks source link

Get user info not work on some device #41

Closed nguyen95 closed 2 years ago

nguyen95 commented 2 years ago

Get user info not work on some device As usual, when request to "https://www.tiktok.com/@${userName}", we receive a response and use it to match with regex: /<script id="NEXT_DATA"([^>]+)>([^<]+)<\/script>/ But some time (or some device), response we received not match with above regex (not include NEXT_DATA), despite including user data. All info in below file, please check it and let me know how to do. Thank you!

https://drive.google.com/file/d/10K1gCnqBVrl3oSonpbyHhBpKASQhBe1w/view?usp=sharing

nguyen95 commented 2 years ago
"UserModule":{
      "users":{
         "dinhhiep1998":{
            "id":"6912505763790144513",
            "shortId":"0",
            "uniqueId":"dinhhiep1998",
            "nickname":"dyjq9mbib6be",
            "avatarLarger":"https:\u002F\u002Fp16-sign-sg.tiktokcdn.com\u002Faweme\u002F1080x1080\u002Ftiktok-obj\u002F1695038697700354.jpeg?x-expires=1636610400&x-signature=NKfkWe%2BvVh1wZ158a5wgFisRVTM%3D",
            "avatarMedium":"https:\u002F\u002Fp16-sign-sg.tiktokcdn.com\u002Faweme\u002F720x720\u002Ftiktok-obj\u002F1695038697700354.jpeg?x-expires=1636610400&x-signature=yKH0oS1Hb9ZMfRFzx7A0%2FNs%2FBX8%3D",
            "avatarThumb":"https:\u002F\u002Fp16-sign-sg.tiktokcdn.com\u002Faweme\u002F100x100\u002Ftiktok-obj\u002F1695038697700354.jpeg?x-expires=1636610400&x-signature=q3T9ynxNdNIzdTuJCOVubWjTVVo%3D",
            "signature":"",
            "createTime":1616514870,
            "verified":false,
            "secUid":"MS4wLjABAAAAYamslXKi6jwRL4V_WoYyfIgSXfOf8eKDwrqJvGyW_MoakEio3d8e2mKs1aEMBOKq",
            "ftc":false,
            "relation":0,
            "openFavorite":false,
            "commentSetting":0,
            "duetSetting":0,
            "stitchSetting":0,
            "privateAccount":false,
            "secret":false,
            "roomId":""
         }
      },
      "stats":{
         "dinhhiep1998":{
            "followerCount":0,
            "followingCount":34,
            "heart":0,
            "heartCount":0,
            "videoCount":0,
            "diggCount":0,
            "needFix":true
         }
      }
   },

I found this part in response but can not get

Davpyu commented 2 years ago

its because tiktok going to change the way they exposed their data from Next.Js to Sigi. look here https://github.com/davidteather/TikTok-Api/issues/735

nguyen95 commented 2 years ago

its because tiktok going to change the way they exposed their data from next to sigi. look here davidteather/TikTok-Api#735

Oh thank @Davpyu! Waiting for an update on this issue.

Davpyu commented 2 years ago

i do experienced this but not on scrapping, just browse tiktok normally. if you found the correct regexp, just make PR here.