Skip to main content

Search Startpage.com from the terminal.

Project description

PyPI Python versions License Build status

Asciicast

sp is a command line utility to search Startpage.com from the terminal.

It is inspired by the projects ddgr and googler.

Table of contents

Installation

$ pip install spcli

Usage

Command Line

$ sp -h
usage: sp.py [-h] [-d] [-f] [-s SITE] [-t SPAN] [-u] [-v] [-np]
             [--browser BROWSER] [--json] [--no-color]
             [keywords [keywords ...]]

Search Startpage.com from the terminal.

positional arguments:
  keywords              search keywords

optional arguments:
  -h, --help            show this help message and exit
  -d, --debug           enable debug logging
  -f, --first           open the first result in a web browser
  -s SITE, --site SITE  search a site
  -t SPAN, --time SPAN  time limit search to 1 d|w|m|y (day,week,month,year)
  -u, --unsafe          disable the family filter
  -v, --version         show program's version number and exit
  -np, --no-prompt      do not enter interactive mode
  --browser BROWSER     open results using this web browser
  --json                output the results in JSON; implies --no-prompt
  --no-color            disable color output

Version 1.0.4
Copyright © 2018 Gary Blackwood <gary@garyblackwood.co.uk>
License: GPLv3
Website: https://github.com/garee/sp

Interactive Mode

f          view the first set of results
n          view the next set of results
p          view the previous set of results
[index]    open search result in web browser
c [index]  copy the search result link to the clipboard
s KEYWORDS perform a search for KEYWORDS
?          show help
q          exit
*          all other inputs are treated as new search keywords

Examples

  1. Search for terms.
$ sp hello world
  1. Search bbc.co.uk for news about brexit:
$ sp -s bbc.co.uk brexit
  1. Search for results from the past 24 hours.
$ sp -t d barcelona fc
  1. Open the first result automatically
$ sp -f python docs
  1. Disable safe search.
$ sp -u pawn
  1. Output in JSON format.
$ sp --json climate change papers

Browser Support

If the BROWSER environment variable exists, it will be used to open search results. If not, sp will attempt to use one from the this list.

You can specify which browser to use using the --browser flag. This also accepts a path to the browser executable.

$ sp --browser firefox

Proxies

The requests library is used to perform the HTTP requests. You can configure proxies by setting the environment variables HTTP_PROXY and HTTPS_PROXY.

$ export HTTP_PROXY="http://10.10.1.10:3128"
$ export HTTPS_PROXY="http://10.10.2.10.1080"

Development Quick Start

Create and activate a virtual environment.

$ mkvirtualenv -p python3 sp
$ workon sp

Install the dependencies.

$ pip install -r requirements.txt

Format the code.

$ black sp/*.py

Run static analysis on the code.

$ pylint sp/*.py
$ flake8 sp/*.py

Troubleshooting

Please create an issue for any problems that you encounter.

  1. Disable the coloured output if it does not work correctly on your system:
$ sp --no-color

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spcli-1.0.4.tar.gz (22.3 kB view details)

Uploaded Source

Built Distribution

spcli-1.0.4-py3-none-any.whl (20.8 kB view details)

Uploaded Python 3

File details

Details for the file spcli-1.0.4.tar.gz.

File metadata

  • Download URL: spcli-1.0.4.tar.gz
  • Upload date:
  • Size: 22.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.20.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5

File hashes

Hashes for spcli-1.0.4.tar.gz
Algorithm Hash digest
SHA256 57fbcb127ce70d006c84009daf9689dcfe77845a625c69970574f9d08de8d0b1
MD5 e918ae2e5de57675f61a14275cdf2ff9
BLAKE2b-256 dd67e9b6a4f3f542e055968472987de8e3b5439cfe662ee0e65ee8f13bc1604c

See more details on using hashes here.

File details

Details for the file spcli-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: spcli-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 20.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.20.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5

File hashes

Hashes for spcli-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 b8d72432fa7f71c4aad9679484bb0e22bd291e375ca1329b31d0543c81fda2bd
MD5 f31b3cbed1232ce96e7616f347110b71
BLAKE2b-256 a2de31eed203e071111c95664e268fda9681b98de2d6f66c82a9e4864568c276

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page