sheldygg / aiotiktok

TikTok Api
MIT License
31 stars 8 forks source link

Feature request - feeds by username #4

Closed johndpope closed 1 year ago

johndpope commented 1 year ago
Screenshot 2023-05-07 at 1 00 00 pm

I will help if I can adjust this - here in the picture - this is app I bought - 4k tokkit - it's good - but no command line. there's 636 videos in their feed.

UPDATE - I found this logic https://github.com/acomarcho/tiktok-api https://github.com/dfreelon/pyktok https://github.com/ART-Open-Source/M-API/blob/c1550880b4097300ee22a24ab9c850542a674230/src/tiktok/tiktok_tools.py#L1

seems like people are stuck on pagination. https://github.com/dfreelon/pyktok/issues/21

https://github.com/acomarcho/tiktok-api/blob/main/services/tiktok.js

super fragile -


  const res = await superagent.get(`https://www.tiktok.com/@${username}`);
    const htmlText = res.text;
    ``;
    // Get AppContext
    const pattern =
      /<script id="SIGI_STATE" type="application\/json">(.*?)<\/script>/s;
    const match = htmlText.match(pattern);

    if (match) {
      const jsonData = JSON.parse(match[1]);

      // Posts
      const itemModule = jsonData.ItemModule;

I normally use BeautifulSoup for this stuff.

import requests
import time
import csv
import re
from bs4 import BeautifulSoup
import json
import os
sheldygg commented 1 year ago

ok, i try make something normal, without selenium and beautiful soop

sheldygg commented 1 year ago

i checked and when i get the video in this way it won't download it, it needs super secret titles to download which i don't know anything about, if you know something, could you share with me?

johndpope commented 1 year ago

I think the approach once upon a time was much more straightforward https://github.com/ART-Open-Source/M-API/blob/c1550880b4097300ee22a24ab9c850542a674230/src/tiktok/tiktok_tools.py#LL85C9-L86C7

this line - goes to a /node/ end point and spits out the results.

this issue represents the tangle to get the data to paginate beyond 30

sheldygg commented 1 year ago

so far did this https://github.com/sheldygg/aiotiktok/commit/29acbf270a4624971e56a32c4f16dbe7ffd7bf80 only 30 videos are returned there, I don’t know what to do next.

sheldygg commented 1 year ago

https://github.com/sheldygg/aiotiktok#signature