Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get profile picture of user who isn't streaming. #38

Closed
ThanoFish opened this issue Jul 2, 2022 · 6 comments
Closed

Get profile picture of user who isn't streaming. #38

ThanoFish opened this issue Jul 2, 2022 · 6 comments

Comments

@ThanoFish
Copy link

I wanted to get the info of any user even if they are not streaming. I found that the getRoomInfo method works great for this, but I can't find the url for the profile picture.

@zerodytrash
Copy link
Owner

You could extract the profile picture URL from page source https://www.tiktok.com/@username
Or use the API, which only works if you submit a valid session cookie: https://www.tiktok.com/api/user/detail/?aid=1988&app_language=en&app_name=tiktok_web&channel=tiktok_web&device_id=7108110397252322822&uniqueId=billieeilish

@ThanoFish
Copy link
Author

use the API, which only works if you submit a valid session cookie: https://www.tiktok.com/api/user/detail/?aid=1988&app_language=en&app_name=tiktok_web&channel=tiktok_web&device_id=7108110397252322822&uniqueId=billieeilish

Thanks

do i just have to replace "billieeilish" in "uniqueId=billieeilish" with the username of the person I want to get info on?

@zerodytrash
Copy link
Owner

do i just have to replace "billieeilish" in "uniqueId=billieeilish" with the username of the person I want to get info on?

Yes

@ThanoFish
Copy link
Author

You could extract the profile picture URL from page source https://www.tiktok.com/@username Or use the API, which only works if you submit a valid session cookie: https://www.tiktok.com/api/user/detail/?aid=1988&app_language=en&app_name=tiktok_web&channel=tiktok_web&device_id=7108110397252322822&uniqueId=billieeilish

I've been trying to do both of these for a while now and both give no info. The "data" key in axios is literally undefined.

@zerodytrash
Copy link
Owner

const axios = require('axios');

axios.get('https://www.tiktok.com/api/user/detail/?aid=1988&app_language=en&app_name=tiktok_web&channel=tiktok_web&device_id=7108110397252322822&uniqueId=billieeilish', {
    headers: {
        'Connection': 'keep-alive',
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.66 Safari/537.36 Edg/103.0.1264.44',
        'Accept': 'application/json',
        'Accept-Encoding': 'gzip, deflate',
        'Accept-Language': 'en-US,en;q=0.9',
        'Cookie': 'sessionid=1d9148c13154b2cf14ff7005021b7904' // enter your sessionid cookie value
    }
}).then(response => {
    console.log(response.data.userInfo.user.avatarLarger);
}).catch(err => {
    console.error(err);
})

@ThanoFish
Copy link
Author

const axios = require('axios');

axios.get('https://www.tiktok.com/api/user/detail/?aid=1988&app_language=en&app_name=tiktok_web&channel=tiktok_web&device_id=7108110397252322822&uniqueId=billieeilish', {
    headers: {
        'Connection': 'keep-alive',
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.66 Safari/537.36 Edg/103.0.1264.44',
        'Accept': 'application/json',
        'Accept-Encoding': 'gzip, deflate',
        'Accept-Language': 'en-US,en;q=0.9',
        'Cookie': 'sessionid=1d9148c13154b2cf14ff7005021b7904' // enter your sessionid cookie value
    }
}).then(response => {
    console.log(response.data.userInfo.user.avatarLarger);
}).catch(err => {
    console.error(err);
})

thank you, this worked perfectly. I forgot to add 2 of the headers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants