English Document | 中文文档

Install

1
pip3 install quickstart-rhy [--upgrade]

qs profile:.qsrc

  • Starting with VERSION 0.3.0, when you first install QuickStart_Rhy and run qs from the command, qs will generate the qs configuration table .qsrc at the following location:
System Location
Windows C:\Users\YOUR_NAME\.qsrc
*nix /Users/YOUR_NAME/.qsrc
  • .qsrcis a configuration table stored in JSON format. When it is first generated, the contents are as follows:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* The comment content in the document does not exist in the file */
{
"basic_settings": {
"default_language": "zh", /* !The default language, ZH for Chinese, EN for English*/
"default_translate_engine": { /* !Default language engine, do not modify "Support" */
"index": 0,
"support": ["default", "TencentCloud"]
},
"default_proxy": "user:password@ip:port or ip:port"
/* Set the download agent. Qs will not use this proxy to download without `-px` */
},
"API_settings": { /* Fill in the API keys you need to use */
"rmbg": "GET: https://www.remove.bg",
"smms": "GET: https://sm.ms",
"darksky": "GET: https://darksky.net/",
"aliyun_oss_acid": "GET: https://www.aliyun.com/product/oss",
"aliyun_oss_ackey": "GET: https://www.aliyun.com/product/oss",
"aliyun_oss_bucket_url": "GET: https://www.aliyun.com/product/oss",
"aliyun_oss_df_bucket": "GET: https://www.aliyun.com/product/oss",
"txyun_scid": "GET: https://console.cloud.tencent.com/",
"txyun_sckey": "GET: https://console.cloud.tencent.com/",
"txyun_cos_df_bucket": "GET: https://console.cloud.tencent.com/",
"txyun_df_region": "GET: ap-[location]",
"qiniu_ac_key": "GET: http://qiniu.com/",
"qiniu_sc_key": "GET: http://qiniu.com/",
"qiniu_bk_name": "GET: [Qiniu Bucket Name]",
"gitee": "GET: http://gitee.com/",
"ipinfo": "GET: https://ipinfo.io/",
"AipImageAPP_ID": "GET: https://cloud.baidu.com/product/imageprocess",
"AipImageAPP_KEY": "GET: https://cloud.baidu.com/product/imageprocess",
"AipImageSECRET_KEY": "GET: https://cloud.baidu.com/product/imageprocess",
"AipNlpAPP_ID" : "GET: https://cloud.baidu.com/product/nlp_apply",
"AipNlpAPP_KEY": "GET: https://cloud.baidu.com/product/nlp_apply",
"AipNlpSECRET_KEY": "GET: https://cloud.baidu.com/product/nlp_apply",
"seafile_communicate_path": "GET: /Path/to/file",
"alapi_token": "GET: https://www.alapi.net/"
}
}
  • About the Default language:
Sign Language Sign Language Sign Language
zh 🇨🇳 en 🇬🇧 jp 🇯🇵
kor 🇰🇷 fra 🇫🇷 spa 🇪🇸
th 🇹🇭 ara 阿拉伯 ru 🇷🇺
pt 🇵🇹 de 🇩🇪 it 🇮🇹
el 🇬🇷 nl 🇵🇱 bul 🇧🇬
est 🇪🇪 dan 🇩🇰 fin 🇫🇮
cs 🇨🇿 rom 🇷🇴 slo 🇸🇮
swe 🇸🇪 hu 🇭🇺 vie 🇻🇳
  • As for the API, some of the apis rely on officially provided Python third-party libraries, but not every user will use them, and qs does not pre-install these Python third-party libraries as dependencies in order to keep the qs installation fun. Therefore, if you need to use the relevant API, please select install from the API Comparison table below.
  • *Special notes 1 : qs relies heavily on https://alapI.net for some of its convenience features, so you might want to consider signing up as a free user of ALAPI for a better experience.
  • *Special notes 2: If you are using a Mac system, qs recommends that you use iTerm as the default terminal to get the best experience

Usage

Command Means Class
qs -u url open url using default browser basic
qs -a app [files] open app or open file by app(for MacOS X) basic
qs -f file open file by default app basic
qs -cal exp calculate exp basic
qs -time view current time basic
qs -top cpu and memory monitor system
qs -clear free memory system
qs -mktar path ... create gzipped archive for path(dir/file) system
qs -untar path ... extract path.tar.* system
qs -mkzip path ... make a zip for path(dir/file) system
qs -unzip path ... extract *.zip system
qs -unrar path ... extract *.rar system
qs -md5 path ... get the md5 value of files system
qs -sha1 path ... get the sha1 value of files system
qs -sha256 path ... get the sha256 value of files system
qs -sha512 path ... get the sha512 value of files system
qs -http [ip:port] [-bind url] start a simple multithread http server, default ip=LAN:8000 network
qs -netinfo [url ...] get url (or in clipboard)’s ip information network
qs -wifi Scan nearby wifi and select connection network
qs -dl [urls] [--help] download file from url(in clipboard) with smart strategy network
qs -upload upload your pypi library network
qs -upgrade update qs network
qs -trans [words] translate the content of [words] or the content in clipboard api
qs -rmbg picture remove image background api
qs -smms picture/*.md upload images (or in markdown) to sm.ms api
qs -upimg -help upload images (or in markdown) to platform (use -help to check) api
qs -alioss -help get aliyun oss api help menu api
qs -txcos -help get tencent cos api help menu api
qs -qiniu -help get qiniu oss api help menu api
qs -weather [address] check weather (of address) api
qs -LG image Use Baidu AIPimage to enlarge image api
qs -nlp [words] Text(or in clipboard) error correction (Baidu Cloud) api
qs -sea get/post [msg] Get Or Post msg by Seafile. api
qs -pasteme [get/post] [password/content] get or post content from/to pasteme.cn api
qs -bcv [url/video code] Download Bilibili video cover api
qs -gbc garbage... China garbage classification query (only by Chinese) api
qs -svi url get short video information with share url api
qs -svd url download short video with share url api
qs -phi url get image links in url (preview on Mac::iTerm) api
qs -stbg picture to [from] Replace color from from to to, default from is transparency image
qs -v2gif video [sz] [fps] generate gif form video image
qs -v2mp4 video format video to mp4 image
qs -rmaudio video Remove audio in video (return mp4 only) image

(By the way, if you are the one of China University Of Petroleum(Beijing), run qs -i to login school network)

New Function: bcv, gbc!

bcv: BiliBili Cover

Use Result
  • Download Bilibili video image, support url like https://www.bilibili.com/video/BV1J4y197Ht or video code like BV1J4y197Ht.

gbc:garbage classification

  • Only support query by using Chinese.

svi/svd

  • svd: Analyze the short video sharing link, output the straight link address of the video and the cover and download it as MP4 (using qs built-in download engine, mp4 is generated depending on ‘Moviepy’ library, it needs to be installed by yourself)
  • svi: Only parse short video link, output video related information, do not download.

Good News!

  • You can search the document of this project on the app uTools!

API

  • QuickStart-Rhy provide apis of some popular online platform, so you can do amazing things with qs!
  • You need to register with the appropriate website in person and fill in the required API keys to ensure that qs is properly invoked
  • Edit ~/.qsrc to set your API keys!

Support API

API Org Pypi Lib Key Value
remove bg link None “rmbg”
smms link None “smms”

Aliyun OSS

link

oss2
“aliyun_oss_acid”
“aliyun_oss_ackey”
“aliyun_oss_df_bucket”
“aliyun_oss_bucket_url”

Qiniu OSS

link

qiniu
“qiniu_ac_key”
“qiniu_sc_key”
“qiniu_bk_name”

Tencent COS

link

cos-python-sdk-v5
“txyun_scid”
“txyun_sckey”
“txyun_df_region”
“txyun_cos_df_bucket”
IPinfo link ipinfo “ipinfo”
Baidu Image
Process

link

aip
“AipImageAPP_ID”
“AipImageAPP_KEY”
“AipImageSECRET_KEY”

Baidu NLP

link

aip
“AipNlpAPP_ID”
“AipNlpAPP_KEY”
“AipNlpSECRET_KEY”
Tencent translate link tencentcloud-sdk-python “txyun_scid”
“txyun_sckey”
“txyun_df_region”
  • .qsrc example:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{
"basic_settings": {
"default_language": "zh",
"default_translate_engine": {
"index": 0,
"support": ["default", "TencentCloud"]
}
},
"API_settings": {
"rmbg": "GET: https://www.remove.bg",
"smms": "GET: https://sm.ms",
"darksky": "GET: https://darksky.net/",
"aliyun_oss_acid": "GET: https://www.aliyun.com/product/oss",
"aliyun_oss_ackey": "GET: https://www.aliyun.com/product/oss",
"aliyun_oss_bucket_url": "GET: https://www.aliyun.com/product/oss",
"aliyun_oss_df_bucket": "GET: https://www.aliyun.com/product/oss",
"txyun_scid": "GET: https://console.cloud.tencent.com/",
"txyun_sckey": "GET: https://console.cloud.tencent.com/",
"txyun_cos_df_bucket": "GET: https://console.cloud.tencent.com/",
"txyun_df_region": "GET: ap-[location]",
"qiniu_ac_key": "GET: http://qiniu.com/",
"qiniu_sc_key": "GET: http://qiniu.com/",
"qiniu_bk_name": "GET: [Qiniu Bucket Name]",
"gitee": "GET: http://gitee.com/",
"ipinfo": "GET: https://ipinfo.io/",
"AipImageAPP_ID": "GET: https://cloud.baidu.com/product/imageprocess",
"AipImageAPP_KEY": "GET: https://cloud.baidu.com/product/imageprocess",
"AipImageSECRET_KEY": "GET: https://cloud.baidu.com/product/imageprocess",
"AipNlpAPP_ID" : "GET: https://cloud.baidu.com/product/nlp_apply",
"AipNlpAPP_KEY": "GET: https://cloud.baidu.com/product/nlp_apply",
"AipNlpSECRET_KEY": "GET: https://cloud.baidu.com/product/nlp_apply",
"seafile_communicate_path": "GET: /Path/to/file"
}
}

API Usage

rmbg

Raw Processed

smms

  • upload image:
1
2
3
4
5
6
➜ Desktop $ qs -smms IMG_4758.jpeg  
+---------------+--------+---------------------------+
| File | Status | url |
+---------------+--------+---------------------------+
| IMG_4758.jpeg | True | https://*.loli.net/*t.jpg |
+---------------+--------+---------------------------+
  • Upload images in markdown file, and replace the images path to urls.
1
2
3
4
5
6
7
8
➜ Desktop $ qs -smms test.md  
+---------------+--------+---------------------------+
| File | Status | url |
+---------------+--------+---------------------------+
| 1.jpg | True | https://*.loli.net/1.jpg |
| 2.jpg | True | https://*.loli.net/2.jpg |
| 3.jpg | True | https://*.loli.net/3.jpg |
+---------------+--------+---------------------------+

Aliyun OSS

Command Function
qs -alioss -up file [bucket] upload file to bucket/default bucket
qs -alioss -rm file [bucket] remove file in bucket
qs -alioss -dl file [bucket] download file from bucket
qs -alioss -ls [bucket] get file info of bucket
Demo
1
2
3
4
5
6
7
8
Bucket Url: https://***.aliyuncs.com/
+--------------------------------+------------+
| File | Size |
+--------------------------------+------------+
| 单片机原理及应用教程第3版.pdf | 25.156 MB |
| 计算机网络(第7版)-谢希仁.pdf | 70.780 MB |
| 软件工程导论.pdf | 100.819 MB |
+--------------------------------+------------+

Qiniu OSS

Command Function
qs -qiniu -up file [bucket] upload file to bucket/default bucket
qs -qiniu -rm file [bucket] remove file in bucket
qs -qiniu -cp url [bucket] copy file from url to bucket
qs -qiniu -dl file [bucket] download file from bucket
qs -qiniu -ls [bucket] get file info of bucket
Demo
1
2
3
4
5
6
7
8
9
10
11
12
13
➜ hexo $ qs -qiniu -ls
Bucket url: http://***.bkt.clouddn.com/
+----------------------------+------------+
| File | Size |
+----------------------------+------------+
| 591918ca03491.jpg | 522.393 KB |
| BaiduExporter.zip | 64.810 KB |
| BitBar.zip | 6.361 MB |
| cover.png | 342.704 KB |
| ev-cover.png | 483.959 KB |
| google-access-helper-2.zip | 111.958 KB |
| weather.15m.py | 13.386 KB |
+----------------------------+------------+

Tencent COS

Command Function
qs -txcos -up file [bucket] upload file to bucket/default bucket
qs -txcos -rm file [bucket] remove file in bucket
qs -txcos -dl file [bucket] download file from bucket
qs -txcos -ls [bucket] get file info of bucket
Demo
1
2
3
4
5
6
7
8
9
10
11
12
13
➜ hexo $ qs -txcos -ls
Bucket url: http://***.myqcloud.com/
+----------------------------+------------+
| File | Size |
+----------------------------+------------+
| 1.jpg | 522.393 KB |
| BaiduExporter.zip | 64.810 KB |
| BitBar.zip | 6.361 MB |
| ev-cover.png | 483.959 KB |
| gd-cover.png | 342.704 KB |
| google-access-helper-2.zip | 111.958 KB |
| weather.15m.py | 13.386 KB |
+----------------------------+------------+

ipinfo

  • Just provide a function: QuickStart_Rhy.api.ipinfo(ip:str=None), and it will return a dict with the ip information.
Demo
1
2
3
>>> from QuickStart_Rhy.api import ipinfo
>>> ipinfo('114.114.114.114')
{'ip': '114.114.114.114', 'hostname': 'public1.114dns.com', 'city': 'Beijing', 'region': 'Beijing', 'country': 'CN', 'loc': '39.9075,116.3972', 'org': 'AS174 Cogent Communications', 'timezone': 'Asia/Shanghai', 'country_name': 'China', 'latitude': '39.9075', 'longitude': '116.3972'}

Tencent Translate

  • After going through several unstable calling methods, I decided to use Tencent Cloud Machine Translation Service as the translation engine of qs, so you need install some library and set your account information at ~/.qsrc by yourself if you want use translate service.
Demo
1
2
$ qs -trans Looking in indexes
查找索引

netinfo

demo

  • As the picture showed, you can get ip information by using domain, ip address or me (keyword) !

upimg

  • upimg has the same function with smms, but upimg not need API keys. It support multiple platform to upload your image, but I do not guarantee that it is safe to upload pictures to any platform.

Tools for developers

Not content to just use qs on the command line? Qs now provides practical tools to help you develop Python applications faster!

ImageTools

  • ColorTools.py:

    • QuickStart_Rhy.ImageTools.ColorTools.get_color_from_str(str_color): get (R, G, B, A=255) from str_color

      Examples:

call return
get_color_from_str('0,0,0,0') (0, 0, 0, 0)
get_color_from_str('0,0,0') (0, 0, 0, 255)
get_color_from_str('FFFFFF') (255, 255, 255, 255)
  • QuickStart_Rhy.ImageTools.ColorTools.transport_back(src: str, to_color, from_color=(0, 0, 0, 0)): replace the from_color with to_color of the Image.open(src).

    Examples:

call return
transport_back('test.jpg', (0, 0, 0, 255)) Replace the transparent color with white

NetTools

  • QuickStart_Rhy.NetTools.check_one_page(url): Determines whether the url is accessible.

  • QuickStart_Rhy.NetTools.formatUrl(try_url): Try adding https:// or http:// to make the try_url accessible (There is no guarantee that the return value will be accessible)

  • QuickStart_Rhy.NetTools.get_ip(): Gets the IP of the current machine under the LAN

  • QuickStart_Rhy.NetTools.size_format(sz, align=False): Format size. 1000000 -> “1.000 MB” if not align else “ 1.000 MB”

  • QuickStart_Rhy.NetTools.get_ip_info(): return dict

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    {
    'status': 'success',
    'country': 'China',
    'countryCode': 'CN',
    'region': 'Province name abbreviations',
    'regionName': 'Province name',
    'city': 'City',
    'zip': '',
    'lat': latitude,
    'lon': longitude,
    'timezone': 'Asia/Shanghai',
    'isp': 'Network operator',
    'org': 'Network operator + location',
    'as': 'AS4134 Chinanet',
    'query': 'Your public IP'
    }
  • QuickStart_Rhy.NetTools.get_fileinfo(url): Return the downloadable links, file names, and requests.head return values.

ThreadTools

  • QuickStart_Rhy.ThreadTools.ThreadFunctionWrapper(threading.Thread): Opens a new thread to run the function.

    • __init__(self, function, *args, **kwargs)
    • run(self): Start run
    • get_res(self): Get function result
  • QuickStart_Rhy.ThreadTools.FileWriters: Write file thread pool

    • __init__(self, filename, workers, mode): mode example: r+, w, rb+, wb
    • wait(self): wait all thread done
    • new_job(self, content, index): new write job

    filename must have been created and pre-allocated enough space

TuiTools

  • QuickStart_Rhy.TuiTools.get_console_width(): just as its name implies
  • QuickStart_Rhy.TuiTools.Bar.RollBar: Support for scrolling bar charts on the command line, you can run qs -top to see the effect.
  • QuickStart_Rhy.TuiTools.Line.Line: Support for line charts on the command line, you can run qs -weather to see the effect.

Wrappers

  • QuickStart_Rhy.Wrapper.set_timeout(num): function wrapper to make the function to terminate at a specified time num.

    • Examples:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    from QuickStart_Rhy.Wrapper import set_timeout
    import time

    @set_timeout(2)
    def fuck(who):
    time.sleep(3)
    return 'fuck {}'.format(who)
    # run this function and it will return False

    @set_timeout(2)
    def fuck(who):
    return 'fuck {}'.format(who)
    # run this function and it will return 'fuck {}'.format(who)