Tiktok video no watermark

FREEMIUM
От yi005 | Обновлено 20 дней назад | Social
Популярность

9.9 / 10

Задержка

721ms

Уровень обслуживания

100%

Health Check

100%

Назад ко всем обсуждениям

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]  # Возвращаем только нужное количество видео

Присоединяйтесь к обсуждению – добавьте комментарий ниже:

Войдите / Зарегистрируйтесь, чтобы публиковать новые комментарии