Getting Public MyDiscovery Userlists from Aquabrowser

Lets say that you need to get a list of all of your MyDiscovery lists. You may want to move them to another system, or you just want to print them all out and take them with you. You could log into MyDiscoveries and click on your lists one by one, but even that doesn’t give you a good printable format. Or you could add this bit of code to your web page and let it take it from there. For this code to work you will need a web server running php.

Replace catalog.mppl.org with your catalog url and mpplbooks with your username.

<html lang="en">
<head>
<meta charset="UTF-8">
<title>All Adult AB Lists</title>
<link rel="stylesheet" type="text/css" href="css/list.css">
</head>
<body>
<h2>All Adult Aquabrowser Lists</h2>
<ol>

<?php
$numOfPagesData = simplexml_load_file("http://catalog.mppl.org/accessible.ashx?q=md_user:%22mpplbooks*&output=xml");
$totalpages = $numOfPagesData->contents->feedbacks->pager->totalpages;
function ListRun($listURL)
{
$data = simplexml_load_file($listURL);
$recordNum = count($data->contents->results->record);
  $itemNum = count($data->contents->results->record->fields[2]->items);
for ($i=0; $i < $recordNum ; $i++)
{

$title = $data->contents->results->record[$i]->fields[1]->title;
$link = $data->contents->results->record[$i]->fields->id;
$link1 = substr("$link", 1);

// Title of list and link

echo "<li class='listTitle'><a href='http://catalog.mppl.org/Accessible.ashx?cmd=frec&hreciid=|mydiscoveries|".$link1."'>".$title."</a>";
for ($n=0; $n < $itemNum; $n++)
{
$itemTitle = $data->contents->results->record->fields[2]->items[$n]->items[6];
$itemAuthor = $data->contents->results->record->fields[2]->items[$n]->items[7];
$itemLink = $data->contents->results->record->fields[2]->items[$n]->items[1];
$itemBib = substr($itemLink,-6);
echo "<ul>";

// Title of item and link

echo "<li><ul>
<li><a href='http://catalog.mppl.org/accessible.ashx?hreciid=".$itemLink."&output=xml'>".$itemTitle."</a></li>
<li>".$itemAuthor."</li>
<li><a href='http://catalog.mppl.org/?hreciid=%7clibrary%2fm%2fmppl-dynix%7c".$itemBib."'>Catalog Link</a></li>
</ul></li>";
echo "</ul>";
}
echo "</li>";
}

}

for ($i = 0; $i <= $totalpages ; $i++)
{
echo "<h2>Counter is equal to " . $i."</h2>";
ListRun('http://catalog.mppl.org/accessible.ashx?q=md_user:"mpplbooks*&curpage='.$i.'&output=xml');
}

?>
</ol>
</body>
</html>

If you have issues with this script let me know in the comments and I’ll look into it.


Posted

in

,

by