コード例 #1
0
# print(udf)

# for i in u['userInfo']['user']:
#     print(i, u['userInfo']['user'][i])
# sleep(2)

# %%
# users = api.getSuggestedUsersbyIDCrawler(count=4, startingId='6880621118412653573', language='en', proxy=None)
# print(users)
# for i in users:
#     print(i)
# %%
# t = api.trending()
# # print(t)
# ta = aj.parse_json(t)
# print(ta.df)

# %%

tik = TikTokApi(debug=True)
req = tik.userPage(
    '6775898460179072005',
    'MS4wLjABAAAAIfd_LMnolP6Kpzsv8JVuGnvxzx_3ODJ6Xxjj6hwx7PqH19_l3xmBppuCikOK_MXi',
    language='en')
# pager = tik.getUserPager('therock', page_size=5)
# print(pager)
print(req.content)
print(req.json())
print('Done')
# u = tik.getUserObject('iamcardib')
コード例 #2
0
total = 0

pager = api.getUserPager(username, page_size=count)

for page in pager:
    printPage(page)
    total += len(page)

print('{} has {} posts'.format(username, total))
all_posts = total

# List all of the posts for a given user after a certain date

APR_24 = 1587757438000  # 2020-04-24 15:43:58 to be precise. Must be ms-precision UNIX timestamp
user = api.getUserObject(username)
page = api.userPage(user['id'], user['secUid'], page_size=30, after=APR_24)

printPage(page['items'])
new_posts = len(page['items'])
print('{} has {} posts after {}'.format(username, new_posts, APR_24))

# Count and list all of the posts before a certain date for a given user with the pager

total = 0
pager = api.getUserPager(username, page_size=count, before=APR_24)

for page in pager:
    printPage(page)
    total += len(page)

print('{} has {} posts from before {}'.format(username, total, APR_24))