从终端搜索startpage.com。
spcli的Python项目详细描述
sp
是从终端搜索startpage.com的命令行实用程序。
目录
安装
$ pip install spcli
用法
命令行
$ 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.2
Copyright © 2018 Gary Blackwood <gary@garyblackwood.co.uk>
License: GPLv3
Website: https://github.com/garee/sp
交互模式
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
示例
- 搜索术语。
$ sp hello world
-
关于BrxIt的消息的搜索^ ^ {CD2> }:
$ sp -s bbc.co.uk brexit
- 搜索过去24小时的结果。
$ sp -t d barcelona fc
- 自动打开第一个结果
$ sp -f python docs
- 禁用安全搜索。
$ sp -u pawn
- 以json格式输出。
$ sp --json climate change papers
浏览器支持
如果存在{{ CD3>}环境变量,则将用于打开搜索结果。否则,sp
将尝试使用this list中的一个。
您可以使用--browser
标志指定要使用的浏览器。它还接受浏览器可执行文件的路径。
$ sp --browser firefox
代理< /H2>
请求库用于执行http请求。您可以通过{a18}^ {< CD6}}和^ {CD7}}来配置代理。
$ exportHTTP_PROXY="http://10.10.1.10:3128" $ exportHTTPS_PROXY="http://10.10.2.10.1080"
开发快速入门
创建并激活虚拟环境。
$ mkvirtualenv -p python3 sp $ workon sp
安装依赖项。
$ pip install -r requirements.txt
格式化代码。
$ black sp/*.py
对代码运行静态分析。
$ pylint sp/*.py $ flake8 sp/*.py
故障排除
如果您遇到任何问题,请create an issue。
- 如果彩色输出在您的系统上不能正常工作,请将其禁用:
$ sp --no-color