Skip to main content

Cws

CLI web search is a CLI search tool that shows the first N results from select search engines.

This started out because I wanted a way to play youtube video's in mpv without needing to open a browser first, because then why not watch it in my browser in the first place. I did find some similar projects but they just opened the results in my browser instead which was once again defeating the point.

The main use-cases are:

  • Searching and fetching youtube/google/'whatever gets implemented' search results from the command line
  • Executing default actions per search provider with the -x flag (see configuration), like opening youtube results in mpv
  • Piping results to external commands to open/play results like your web browser or mpv for youtube

it heavily relies on rapidapi endpoints for now. Which means you need to register and configure personal API tokens for this to work. See the configuration section below for more info.

Development is done on irregular intervals, while heavily distracted so expect nothing. This is currently a first usable version, that will probably change a lot. Core functionality should stay about the same though.

Todo (for now):

  • -c flag that shows only 1 result and copies that
  • Interactive mode that allows selection of result and applying an action like copy or open
  • Add more search providers
  • Possibly add some webscraping fallback for when no api's are configured or free limits are reached

Installation

$ pip install cws_clisearch

Configuration

Configuration is done through .yml files either in $HOME or $XDG_HOME/cws/. There's 2 different config files, one mandatory and one optional:

  • .cws_tokens.yml (mandatory)
  • .cws_config.yml (optional)

.cws_tokens.yml

This is where your rapidapi tokens are loaded from.

Example:

google: "$token" # Get it from https://rapidapi.com/apigeek/api/google-search3/
youtube: "$token" # Get it from https://rapidapi.com/marindelija/api/youtube-search-results/

Use the --list-providers option to list all posibilities.

.cws_config.yml

This is where you override default settings of cws.

Example with defaults shown:

default_provider: 'google'
provider:
  youtube:
    default_action: 'mpv'
  google:
    default_action: 'firefox'

Usage

See cws -h for general usage information.

For now Google is the default search provider. The -x option implies -u and -n1, then pipes that output to whatever you want. It's also safe to manually use the -u and -n1 options to pipe results. This does not work with mpv, just like echo '$youtube_url' | mpv wouldn't. Use -x as a work-around.

Metadata

Release files for cws-clisearch 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cws-clisearch 0.3.2
File Size Uploaded
cws_clisearch-0.3.2.tar.gz 9.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cws-clisearch 0.3.2
File Interpreter ABI Platform
cws_clisearch-0.3.2-py3-none-any.whl Python 3 none any Details

Total release size: 20.6 kB

Release files / cws_clisearch-0.3.2.tar.gz

Download URL cws_clisearch-0.3.2.tar.gz
Size 9.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0a6aefc159c3897c5edefb0a00dddb48a11c7868960354d236ea2e52097c89fd
BLAKE2b-256 checksum
How to use checksums
dba5844ba8eb6a8d5ee2fbd11e6a4a8a1a1bf35754d823d31c15a39c2d9b0947
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

Release files / cws_clisearch-0.3.2-py3-none-any.whl

Download URL cws_clisearch-0.3.2-py3-none-any.whl
Size 11.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4aaedd67c40877d1e20fed105a89fe61e5c982f4b855cd4b28616287fbbb4655
BLAKE2b-256 checksum
How to use checksums
d962f78f056cca9b8ffb744e0deacfdda89a028fec6e1056ced25abd8cc195a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

Release history Release notifications | RSS feed

This release

0.3.2 This release

2 release files

0.3.1

2 release files

0.3

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page