Tiktok video no watermark

FREEMIUM
Por yi005 | Atualizado לפני 21 ימים | Social
Popularidade

9.9 / 10

Latência

726ms

Nível de serviço

100%

Health Check

100%

Voltar para todas as discussões

Automatically pull cursor ID?

Rapid account: Rapidrev
rapidrev
לפני 6 חודשים

I am using make.com + rapidapi + airtable to make a tik tok scraper, but everytime I want to pull the next page, I need to manually grab the cursor id from data fetch in make.com , does anyone know how to pull the cursor id automatically so i can just let the scenario run by itself and scrape all the tik tok videos in one go?

Rapid account: Finchgangster
finchgangster Commented לפני 4 חודשים

def get_videos_with_cursor(video_count):
video_links = []
count_downloaded = 0
cursor = “0”

while count_downloaded < video_count:
    print(f"Запрос видео с курсором: {cursor}")
    querystring = {
        "unique_id": "@tiktok",
        "user_id": "",
        "count": "35",
        "cursor": cursor
    }

    response = requests.get(base_url, headers=headers, params=querystring)
    data = response.json()

    current_links = [video['play'] for video in data.get('data', {}).get('videos', [])]
    video_links.extend(current_links)
    count_downloaded += len(current_links)

    if len(current_links) == 0:  # Если в текущем ответе нет ссылок на видео
        print("Больше видео для загрузки нет.")
        break

    if 'cursor' in data.get('data', {}):
        cursor = data['data']['cursor']
        print(f"Новый курсор для следующего запроса: {cursor}")
    else:
        print("В ответе нет курсора, но продолжим загрузку, так как еще не достигнуто нужное количество видео.")

return video_links[:video_count]  # Возвращаем только нужное количество видео

Junte-se à discussão - adicione o comentário abaixo:

Efetue login / inscreva-se para postar novos comentários