Skip to content
This repository was archived by the owner on Dec 22, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added all the files
  • Loading branch information
Aditya-Rajgor authored Oct 23, 2021
commit 52664f66d7c253f45e5143cf1d88c43dc774113a
1 change: 1 addition & 0 deletions Scripts/API/tiktok-unofficial/deployment-files/Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: sh setup.sh && streamlit run main.py
29 changes: 29 additions & 0 deletions Scripts/API/tiktok-unofficial/deployment-files/TkApi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from TikTokApi import TikTokApi
from datetime import datetime

class TkTkUser:

def __init__(self, username, custom_verifyFp):
self.username = username
self.custom_vefifyFp = custom_verifyFp
self.api = TikTokApi.get_instance(custom_verifyFp=custom_verifyFp,
use_selenium=True,
use_test_endpoint=True)
# custom_verifyFp is the string generated by browser and verify the identity of the browser

data = self.api.get_user(username=username)
self.json_data = data

self.id_ = data['userInfo']['user']['id']
# self.username = data['userInfo']['user']['uniqueId']
self.nickname = data['userInfo']['user']['nickname']
self.is_private = data['userInfo']['user']['privateAccount']
self.is_verified = data['userInfo']['user']['verified']
self.followerCount = data['userInfo']['stats']['followerCount']
self.followingCount = data['userInfo']['stats']['followingCount']
self.heartCount = data['userInfo']['stats']['heartCount']
self.videoCount = data['userInfo']['stats']['videoCount']
self.created_at = datetime.strftime(datetime.fromtimestamp(data['userInfo']['user']['createTime']), '%Y-%m-%d')
for i in data['seoProps']['jsonldList']:
if i[0] == 'Person':
self.description = i[1]['description']
Binary file not shown.
39 changes: 39 additions & 0 deletions Scripts/API/tiktok-unofficial/deployment-files/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import streamlit as st
import pandas as pd
from TkApi import TkTkUser


#chromewebdriver version chrome=95.0.4638.54

st.title('Enter the tiktok user')
input = st.text_input('Example: therock', value='therock')
veri_fp_input = st.text_input('Enter custom verifyFp', 'verify_kv2emkaa_mYpSNrSe_ZzZZ_4y7V_9Pja_9IfMJCKxofNp')
st.markdown('[How to get Custom verifyFp](https://youtu.be/zwLmLfVI-VQ)')


try:
if input != '':
st.write('fetching tiktok user data for the {}...'.format(input))
user = TkTkUser(str(input), custom_verifyFp=veri_fp_input)

df = pd.DataFrame({"Feature": ['username', 'Description', 'nickname', 'followerCount', 'followingCount',
'videoCount', 'is_private', 'is_verified'],
"Value": [user.username, user.description, user.nickname, user.followerCount,
user.followingCount, user.videoCount, user.is_private, user.is_verified]})

st.write(df.astype(str))

st.info('Created on: 21th October 2021 by [Aditya Rajgor](https://github.com/Aditya-Rajgor)')



else:
st.write('input the verifyFp string')
pass

except Exception as e:
print(e)
#st.write(e)

st.write('If you are in India, You might have to use VPN profile')

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
streamlit<=1.0.0
pandas==1.3.3
TikTokApi==4.0.4
16 changes: 16 additions & 0 deletions Scripts/API/tiktok-unofficial/deployment-files/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
mkdir -p ~/.streamlit/

echo "\
[server]\n\
port = $PORT\n\
enableCORS = false\n\
headless = true\n\
\n\
[theme]\n\
primaryColor='#F63366'\n\
backgroundColor='#0E1117'\n\
secondaryBackgroundColor='#31333F'\n\
textColor='#FAFAFA'\n\
font='sans serif'\n\
\n\
" > ~/.streamlit/config.toml