Export Media URL (Resolved)


#1

We are trying to export videos from Kaltura.com account using the script provided at
Migration considerations

But when trying to use it it gives me

PHP Fatal error: Uncaught exception ‘KalturaException’ with message ‘Missing parameter “id”’ in /opt/kaltura/web/content/clientlibs/php5/KalturaClientBase.php:894

Any idea why this might be happening?


#2

Hi @melaleuca5,

More info is needed. That’s the line in the client’s code where the exception is thrown but many many paths can lead there.
Please provide the full trace.

Thanks,


#3

@jess here you go.

ubuntu@k3:~/Kaltura-Library-Export-Excel$ php entries.php id key http://www.kaltura.com/
PHP Notice: Undefined offset: 0 in /home/ubuntu/Kaltura-Library-Export-Excel/entries.php on line 44
PHP Notice: Trying to get property of non-object in /home/ubuntu/Kaltura-Library-Export-Excel/entries.php on line 44
PHP Fatal error: Uncaught exception ‘KalturaException’ with message ‘Missing parameter “id”’ in /opt/kaltura/web/content/clientlibs/php5/KalturaClientBase.php:894
Stack trace:
#0 /opt/kaltura/web/content/clientlibs/php5/KalturaClient.php(1483): KalturaClientBase->throwExceptionIfError(Array)
#1 /home/ubuntu/Kaltura-Library-Export-Excel/entries.php(45): KalturaCategoryService->get(NULL)
#2 {main}
thrown in /opt/kaltura/web/content/clientlibs/php5/KalturaClientBase.php on line 894


#4

@jess does that help


#5

Hi @melaleuca5,

And line 44 of /home/ubuntu/Kaltura-Library-Export-Excel/entries.php reads?
The thread you referred to contains two scripts and a lot of posts besides:)
It would therefore be best if you attached the exact code you’re running.

If line 44 is:

$cat = $client->category->get($cat_id);

Then the reason is relatively obvious:) To wit: if an entry is not associated with any categories,

$cat_entry->objects[0]->categoryId;

will be undefined, which in turn means $cat_id will also be undefined and so:

$cat = $client->category->get($cat_id);

Will fail with:

PHP Fatal error: Uncaught exception ‘KalturaException’ with message ‘Missing parameter “id”’

You should check whether $cat_entry->objects[0]->categoryId is defined before trying to obtain the category name, like so:

if (isset($cat_entry->objects[0]->categoryId)){
                $cat_id=$cat_entry->objects[0]->categoryId;
                $cat = $client->category->get($cat_id);
}else{
                $cat = "N/A"
}

#6

Awesome made those changes and things started to work. A couple questions I have 4000+ media entries I am changing the page index to get all of them. Page Size is there a limit in the api, I tried higher than 500 but still just returns 500.

What does processed_entries do?

$page_index=1;
$pager->pageSize = 500;
$processed_entries=0;


#7

Hi @melaleuca5,

You cannot get more than 500 entries in one request. That’s why paging is necessary.
The code sets the page index to 1 initially and then starts iterating over the entries, increasing $page_index by one at the end of each iteration. And so, during the first iteration, you’ll get the first 500 entries to process [page 1], in the second, entries 500 to 1000 [page 2] and so forth until all entries are processed.


#8

Yes that what I did and got them all thanks.