Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Restricting search period
# Function to create string for search start date
def get_start_date_string(search_period_days):
"""Returns string for date at start of search period."""
search_start_date = – timedelta(search_period_days)
date_string = datetime(year=search_start_date.year,month=search_start_date.month,‘%Y-%m-%dT%H:%M:%SZ’)
return date_string
# Creating date string and executing search
date_string = get_start_date_string(7)
results =, part=snippet’,
type=video’, order=viewCount’, maxResults=50,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.