Tiktok video no watermark

फ्रीमियम
द्वारा yi005 | अपडेट किया गया 20 days ago | Social
लोकप्रियता

9.9 / 10

लेटेंसी

721ms

सेवा का स्तर

100%

Health Check

100%

सभी चर्चाओं पर वापस जाएं

Automatically pull cursor ID?

Rapid account: Rapidrev
rapidrev
6 months ago

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 months ago

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

चर्चा में शामिल हों - नीचे टिप्पणी जोड़ें:

नई टिप्पणियाँ पोस्ट करने के लिए लॉग इन / साइनअप करें