Some preliminary results from my attempt to build a wrapper API around PACER:
Just before you view a document in PACER, you’re greeted by a receipt page which cheerfully shows you just how much you’re being overcharged for the document in question. The table has the following format (once intermediate cluttering nonsense is excised):
<table> <tr>Pacer Service Center</tr> <tr>Transaction Receipt> <tr></tr><tr></tr>† <tr>[current time*]</tr> <tr>[Pacer login and client code]</tr> <tr>[Description and case number**]</tr> <tr> <th>Billable Pages:</th> <td>[# of billable pages]</td> <th>Cost:</th> <td>[cost, in $] </tr> <tr></tr><tr></tr> </table> </code>
† Yes they really do use two empty rows as spacers.
* This is the current time, (fortunately) in the standard
"%a %b %d %H:%M:%S %Y" format. It seems to be in the time zone of the court.
** This row is entirely useless (for our purposes, anyway), as presumably if you’ve reached the receipt page you know what case you’re in and what document you just selected.
There’s really only one useful bit of information in here, and that’s the number of pages (from which the cost can be derived).
Note though that it really is billable pages; the rare documents that are free (that is, orders that are so marked) will have 0 here, and documents longer than the 30 page cap will have 30 here. (NB: in these cases PACER adds extra rows to this table. I haven’t yet figured this part out, and so the code below probably doesn’t work in such cases.) Update: After some investigation, in the case of free opinions, the billable pages field still lists the total number of pages. The added row is at bottom and so should not affect any of the code below.
I use BeautifulSoup (Python; MIT license) for HTML scraping. This is the code that extracts out how many (billable) pages there are:
And here’s the cost (which is currently just $0.10 per page, but hey, this could change in the future):
Update for documents with attachments
Some documents (a lot, actually) come with attachments. In this case putting in the document # into qryDocument.pl (like we do) doesn’t give a receipt page, it gives a “Document Selection Menu”.
The link to the actual main document is given by (BeautifulSoup code):
Then you get to a receipt page which can be processed as described above.
onClick handler on this link. I have no idea what it does, and copy-pasting just that link into the address bar seems to work, so…)
The number of pages (in the main document) is given by
For some reason this page also tells you the size of the PDF; something I don’t think the usual receipt page has. Not sure what you’d need it for, but this is how you get it:
The attachments themselves should start at
soup.table.find_all('tr'). So if an attachment is in
tr number X, its info should be as follows:
Number, although you should know this already:
Title (which in my experience is usually just the very-unhelpful “Exhibit “):
Page count (not sure if billable or total. probably total):
You know when you’ve reached the end of the attachments when you see a
tr with an
hr in it. (Optionally, checking if the
.text in BeautifulSoup is empty seems to work too.)