-
-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Fetch Peertube Outbox activities" Docs is not working (for me) #41
Comments
Hi @scammo |
Hey, thanks for your quick result. I'm still getting errors when using the linked code and following two handles:
|
There are 2 different things: thunderbird_channel@tilvids.com You're true, Announce->object is a string (url) blender_channel@video.blender.org This one is more Nginx-y. Gateway randomly fails. So you need to catch exception. Here is a naive example of how to do that : use ActivityPhp\Server;
use Exception;
/* ------------------------------------------------------------------
| Use an instance with a PeerTube flavor
------------------------------------------------------------------ */
// Create a server instance and allow peertube ontology
$server = new Server([
'ontologies' => [
'peertube',
]
]);
$handle = 'blender_channel@video.blender.org';
$handle = 'thunderbird_channel@tilvids.com';
// Get an actor's outbox as an OrderedCollection
$outbox = $server->outbox($handle);
// Prepare a stack
$pages = [];
// Browse first page
$page = $outbox->getPage($outbox->get()->first);
// Browse all pages and get public actvities
$pages[] = $page;
while ($page->next !== null) {
$page = readNextPage($outbox, $page);
$pages[] = $page;
}
echo "\n";
// Now we can work with pages
foreach ($pages as $page) {
foreach ($page->orderedItems as $item) {
echo sprintf(
"Type=%s, NameOrUrl=%s\n",
$item->type, // Activity type
is_object($item->object) //
? $item->object->name // Video name
: $item->object // Video Url
);
}
}
/**
* This function retry to read the failing page FOREVER
*/
function readNextPage($outbox, $page)
{
try {
return $outbox->getPage($page->next);
} catch(Exception $e) {
sleep(5);
}
return readNextPage($outbox, $page);
} Please take into consideration that this is just an example which should neither be used as is in a production environment nor in a controller, whether with Laravel or another framework 😉 |
I've been trying to run https://landrok.github.io/activitypub/fetch-peertube-outbox-activities.html but I can't get a result from the various Peertube accounts. For example: blender@video.blender.org.
Could you check if the documentation is still correct? Could you maybe look at some sample profiles that work with the script?
The first issues their about undefined properties, but event after defining them I still ran into issues.
Thanks again for all your work and documentation!
The text was updated successfully, but these errors were encountered: