Open Usage Examples#
The asrch open command allows you to retrieve contents from a webpage using various modes. Below are some examples demonstrating how to use this command with different options.
Note
The following flags can be used for any command:
--header
--proxy
--log
Retrieve Text Content
To retrieve the text content of a webpage:
python -m asrch open text --url "http://example.com"
Retrieve Body Content
To retrieve the body content of a webpage:
python -m asrch open body --url "http://example.com"
Retrieve JavaScript Content
To retrieve JavaScript content from a webpage:
python -m asrch open js --url "http://example.com"
Retrieve HTML Content
To retrieve HTML content of a webpage:
python -m asrch open html --url "http://example.com"
Retrieve Images
To retrieve images from a webpage:
python -m asrch open img --url "http://example.com"
Take a Screenshot
To take a screenshot of a webpage:
python -m asrch open ss --url "http://example.com"
Advanced Options#
Use a Proxy
To send the request through a proxy:
python -m asrch open html --url "http://example.com" --proxy "192.168.1.1:8080"
Show Browser Header
To display the browser header:
python -m asrch open html --url "http://example.com" --header
Download Images
To download all returned image URLs:
python -m asrch open img --url "http://example.com" --download
Enable Logging
To enable logging messages:
python -m asrch open html --url "http://example.com" --log
Suppress Logging (Emacs Mode) *DEPRECATED*
To suppress all logs (intended for Emacs plugin, not typical CLI usage):
python -m asrch open html --url "http://example.com" --no-log
Use No Driver Mode
To use a combination of requests and BeautifulSoup instead of Selenium (faster but more detectable):
python -m asrch open html --url "http://example.com" --nodriver
Specify HTML Parser
To specify the HTML parser to use with nodriver mode:
python -m asrch open html --url "http://example.com" --nodriver --parser "lxml"
Help#
To display help for the command:
python -m asrch open --help
These examples cover a range of typical use cases for the asrch open command. Adapt them as needed to fit the specific requirements of your project.