open guide

open guide#

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

  1. Retrieve Text Content

    To retrieve the text content of a webpage:

    python -m asrch open text --url "http://example.com"
    
  2. Retrieve Body Content

    To retrieve the body content of a webpage:

    python -m asrch open body --url "http://example.com"
    
  3. Retrieve JavaScript Content

    To retrieve JavaScript content from a webpage:

    python -m asrch open js --url "http://example.com"
    
  4. Retrieve HTML Content

    To retrieve HTML content of a webpage:

    python -m asrch open html --url "http://example.com"
    
  5. Retrieve Images

    To retrieve images from a webpage:

    python -m asrch open img --url "http://example.com"
    
  6. Take a Screenshot

    To take a screenshot of a webpage:

    python -m asrch open ss --url "http://example.com"
    

Advanced Options#

  1. 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"
    
  2. Show Browser Header

    To display the browser header:

    python -m asrch open html --url "http://example.com" --header
    
  3. Download Images

    To download all returned image URLs:

    python -m asrch open img --url "http://example.com" --download
    
  4. Enable Logging

    To enable logging messages:

    python -m asrch open html --url "http://example.com" --log
    
  5. 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
    
  6. 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
    
  7. 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.