Skip to content

Commit

Permalink
Update for v5 of TikTokApi
Browse files Browse the repository at this point in the history
  • Loading branch information
dwoffinden committed Feb 14, 2022
1 parent b54d87e commit 0de2fa2
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions postprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# Custom Domain
ghPagesURL = "https://daw.dev/tiktok-rss-flat/"

api = TikTokApi.get_instance()
api = TikTokApi()

count = 10

Expand All @@ -18,10 +18,8 @@
for row in cf:
user = row['username']

print (user)
print(f'Running for user \'{user}\'')

tiktoks = api.by_username(user, count=count)

fg = FeedGenerator()
fg.id('https://tiktok.com/@' + user)
fg.title(user + ' TikTok')
Expand All @@ -35,17 +33,17 @@
# Set the last modification time for the feed to be the most recent post, else now.
updated=None

for tiktok in tiktoks:
for tiktok in api.user(username=user).videos(count=count):
fe = fg.add_entry()
link = "https://tiktok.com/@" + user + "/video/" + tiktok['id']
link = "https://tiktok.com/@" + user + "/video/" + tiktok.id
fe.id(link)
ts = datetime.fromtimestamp(tiktok['createTime'], timezone.utc)
ts = datetime.fromtimestamp(tiktok.as_dict['createTime'], timezone.utc)
fe.published(ts)
fe.updated(ts)
updated = max(ts, updated) if updated else ts
fe.title(tiktok['desc'])
fe.title(tiktok.as_dict['desc'])
fe.link(href=link)
fe.description("<img src='" + tiktok['video']['cover'] + "' />")
fe.description("<img src='" + tiktok.as_dict['video']['cover'] + "' />")

fg.updated(updated)

Expand Down

0 comments on commit 0de2fa2

Please sign in to comment.