'Order YouTube comments by date in ascending order

I am using the YouTube Data API v3 to scrape all the top-level comments from a video's comment section. I noticed that the requested comments are ordered by the time they were posted in descending order (AKA: newest first).

Is there a way to sort comments in reverse order (AKA: oldest first)?

I am sending my requests from Python. This is what it looks like:

import json
import requests

# Build request
url = 'https://youtube.googleapis.com/youtube/v3/commentThreads?' + \
    'part=snippet&' + \
    'maxResults=50&' + \
    'moderationStatus=published&' + \
    'order=time&' + \                   # Sort by time published
    'textFormat=plainText&' + \
    'videoId=ZpNHmDnHr6A&' + \          # Random video
    'fields=' + \
        'nextPageToken%2C%20' + \       # Get nextPageToken
        'items(' + \                    # Get textOriginal and publishedAt
            'snippet%2FtopLevelComment%2Fsnippet%2FtextOriginal%2C%20' + \
            'snippet%2FtopLevelComment%2Fsnippet%2FpublishedAt)&' + \
    f'key={key}' # Your API Key here

# Response to dictionary
r = json.loads(requests.get(url).text)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source