Support BeautifulSoup 4 or 3 for compatibility