Use MultiParser for unified scraping
masterThe MultiParser object wraps multiple scraping libraries (BeautifulSoup, lxml, pyquery, and requests-html) into a single interface. This allows you to switch between different parsing strategies (like CSS selectors or XPath) using a single object without re-initializing different libraries.
To use it, pass the raw HTML content and the encoding (which can be auto-detected from a requests response) to the MultiParser constructor.
from pywebcopy.parsers import MultiParser
import requests
req = requests.get('http://google.com')
html = req.content
encoding = req.encoding
# Initialize the unified parser
wp = MultiParser(html, encoding)