private static String docidFromURL(URL url) throws HostNoGV, NoQuery, NoDocId, DocIdInvalid {
        /** Google Video */
        String queryURL;
        int startDocId, endDocId;

        if ((url.getHost() == null) ||
           (url.getHost().indexOf("video.google.com") == -1)) {
            throw new HostNoGV();
        }
        
        if ((queryURL = url.getQuery()) == null) {
            throw new NoQuery();
        }

        if ((startDocId = queryURL.indexOf("docid=")) == -1) {
            throw new NoDocId();
        }

        startDocId += "docid=".length();
        endDocId = startDocId;

        if ((endDocId == queryURL.length()) ||
            !((Character.isDigit(queryURL.charAt(endDocId))) || (queryURL.charAt(endDocId) == '-'))) {
            throw new DocIdInvalid();
        }
        endDocId++;

        while ((endDocId < queryURL.length()) &&
                (Character.isDigit(queryURL.charAt(endDocId))))
            endDocId++;

        return queryURL.substring(startDocId, endDocId);
    }