Hi @Jess,
The code below is giving me 4863 entries
from datetime import datetime, timedelta
import KalturaClient.exceptions
import pandas as pd
from KalturaClient import *
from KalturaClient.Plugins.Core import *
import re
def auth(secret, partner_id, user_id, service_url, privileges):
config = KalturaConfiguration(partner_id)
config.serviceUrl = service_url
k_type = KalturaSessionType.ADMIN
expiry = 86400
client = KalturaClient(config)
ks = client.session.start(secret, user_id, k_type, partner_id, expiry, privileges)
client.setKs(ks)
return client
def write_to_excel(data, columns):
df = pd.DataFrame(data, columns=columns)
df.to_excel("data.xlsx", index=False)
def get_media(client, first_run=False):
columns = ["Media ID", "Title", "URL", "Description", "Thumbnail Image URL", "Created By", "Created On", "Category", "Tags",
"Length", "Plays", "Likes"]
PAGESIZE = 500
error = False
i = 0
data = []
while not error:
try:
print(f"Downloading Page {i}...")
filter = KalturaMediaEntryFilter()
filter.categoryAncestorIdIn = "19562491"
if not first_run:
filter.createdAtGreaterThanOrEqual = int((datetime.utcnow() - timedelta(days=1)).timestamp())
pager = KalturaFilterPager()
pager.pageSize = PAGESIZE
pager.pageIndex = i
result = client.media.list(filter, pager)
for obj in result.objects:
result_data = vars(obj)
obj_data = [result_data['id'], result_data["name"],
f"https://media.arup.com/media/{result_data['id']}", "",
result_data["thumbnailUrl"], result_data["userId"], "",
"", result_data["tags"], result_data["duration"],
result_data["plays"], result_data["votes"]]
data.append(obj_data)
i += 1
except Exception as err:
print(err)
error = True
write_to_excel(data, columns)
if __name__ == '__main__':
secret =
user_id =
service_url =
partner_id =
privileges = "*,disableentitlement"
client = auth(secret, partner_id, user_id, service_url, privileges)
get_media(client, True)
print("...Done")