Move functions into utils.py.
Support additional URL kinds.

Use page numbers instead of st numbers to simplify things.
Count pages from 1.