
Twitter Search CLI
## Install
pip install ts
## Usage
Before actual usage, you need to initialize config file first:
ts --init
The first time you run ts, it will guide you through an OAuth authentication process.
The tokens will be stored at `~/.ts.config.json`, any time you want refresh the tokens, run:
ts --auth
to make authentication again and update the tokens in config.
Run `ts -h` to see complete usage instructions:
```
usage: ts [-c COUNT] [-l LANG] [--link] [-d] QUERY
ts [--init|--auth|--config CONFIG] [-d]
Twitter Search CLI
Search options:
QUERY search query, see:
https://dev.twitter.com/rest/public/search
-c COUNT set result number, by default it's 50
-l LANG set search language (en, zh-cn), see:
https://dev.twitter.com/rest/reference/get/help/languages
Display options:
--link append link with tweet
-d enable debug log
-dd debug deeper (more verbose)
Image options:
--download-medias DOWNLOAD_MEDIAS
Download medias by tweet id or url
--auto-naming Name the downloaded files automatically, if not
passed, name in the url will be used.
--download-dir DOWNLOAD_DIR
dir path to download medias, by default it's current
dir
Other options:
--init init config file
--auth make authentication with twitter
--config {proxy} config ts, support arguments: `proxy`
-h, --help show this help message and exit
```
### Search Tweets
The search syntax is the same as [Twitter Web Search](https://twitter.com/search-home) or
[Twitter Search API](https://dev.twitter.com/rest/public/search).
Here are some common search query examples:
1. Find what a person had said:
ts 'from:NASA Elon Musk'
2. Find what people said to a person in a topic:
ts '#Hearthstone to:bdbrode'
### Download Media in Tweet
You can download photos or videos in a tweet, animated gif is likely not supported yet,
contributions are welcomed.
See usage examples below:
1. Download media (videos) to current directory:
ts --download-media 'https://twitter.com/iyasareru_d/status/1013023169408569344'
ts --download-media 1013023169408569344
2. Download media (photos) to a specific path, using auto generated names:
ts --download-dir ~/Downloads --auto-name --download-media \
https://twitter.com/bangqiaoyan2018/status/1012941662937444357
## Proxy
ts supports proxying, you can set proxy by run ``ts --config proxy``,
a proxy address is something like `http://localhost:1000` or `https://user:pass@fast.proxy.com`.
Note that by default ts only supports HTTP(S) proxying, if you want to use socks5 proxy,
you'll need to install `requests[socks]` before using it. For more information see
[requests document](http://docs.python-requests.org/en/master/user/advanced/#socks).
Metadata
Release files for ts 0.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ts-0.5.1.tar.gz | 13.7 kB | Without provenance | Details for ts-0.5.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ts-0.5.1-py2-none-any.whl | Python 2 | none | any | Details for ts-0.5.1-py2-none-any.whl |
Total release size: 28.1 kB
Release files / ts-0.5.1.tar.gz
| Download URL | ts-0.5.1.tar.gz |
|---|---|
| Size | 13.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
acf085d6000c0a45e847e26164a31bd3685bd80d836ee9585e7dd826b72449c7
|
|
BLAKE2b-256 checksum How to use checksums |
26dd76551999e37032441d1190d7df27c30fc75adbb203dacb91a2a72e8b7202
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / ts-0.5.1-py2-none-any.whl
| Download URL | ts-0.5.1-py2-none-any.whl |
|---|---|
| Size | 14.4 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
05b50b9f2e0fd5b7e670be69604b58dc7dc741cf954a6b67f2901602d38d0d45
|
|
BLAKE2b-256 checksum How to use checksums |
c1ea84d26574e1c34078d156aad9d8546725242681fb92ece49939548ba1d661
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for ts 0.5.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.