'`doc_or_html`s html page or doc and returns list of urls, the regex
flag indicates we don\'t parse via lxml and just search the html.'

def get_urls(self, doc_or_html, titles=False, regex=False):

    if (doc_or_html is None):
        log.critical('Must    extract    urls    from    either    html,    text    or    doc!')
        return []
    if regex:
        doc_or_html = re.sub('<[^<]+?>', '    ', str(doc_or_html))
        doc_or_html = re.findall('http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\\(\\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', doc_or_html)
        doc_or_html = [i.strip() for i in doc_or_html]
        return (doc_or_html or [])
    if isinstance(doc_or_html, str):
        doc = self.parser.fromstring(doc_or_html)
    else:
        doc = doc_or_html
    return self._get_urls(doc, titles)
