public List<HtmlTemplate> getHtmlTemplate(String urlString) {
        List<HtmlTemplate> pageTemplates = new ArrayList<>();
        if (urlPatternMap != null) {
            try {
                URL url = new URL(urlString);
                String key = urlPrefix(url);
                List<UrlPattern> patterns = urlPatternMap.get(key);
                for (UrlPattern urlPattern : patterns) {
                    Matcher matcher = urlPattern.getRegexPattern().matcher(urlString);
                    if (matcher.find()) {
                        //匹配成功
                        pageTemplates.addAll(urlPattern.getHtmlTemplates());
                    }
                }
            } catch (Exception e) {
                LOGGER.error("获取URL抽取规则失败：" + urlString, e);
            }
        }
        return pageTemplates;
    }
public List < HtmlTemplate > getHtmlTemplate ( String urlString ) { List < HtmlTemplate > pageTemplates = new ArrayList < > ( ) ; if ( urlPatternMap != null ) { try { URL url = new URL ( urlString ) ; String key = urlPrefix ( url ) ; List < UrlPattern > patterns = urlPatternMap . get ( key ) ; for ( UrlPattern urlPattern : patterns ) { Matcher matcher = urlPattern . getRegexPattern ( ) . matcher ( urlString ) ; if ( matcher . find ( ) ) { pageTemplates . addAll ( urlPattern . getHtmlTemplates ( ) ) ; } } } catch ( Exception e ) { LOGGER . error ( "获取URL抽取规则失败：" + urlString , e ) ; } } return pageTemplates ; }
获取一个可以用来抽取特定URL的页面模板集合

@param urlString url
@return 页面模板集合