RFC: Separate function to extract a Pkg name from a URL

Makes it possible to access this feature as a consenting adult, as discussed in #9004.