yt-research 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- yt_research-0.1.0/.github/workflows/ci.yml +66 -0
- yt_research-0.1.0/.github/workflows/release.yml +72 -0
- yt_research-0.1.0/.gitignore +14 -0
- yt_research-0.1.0/CHANGELOG.md +18 -0
- yt_research-0.1.0/CODE_OF_CONDUCT.md +18 -0
- yt_research-0.1.0/CONTRIBUTING.md +28 -0
- yt_research-0.1.0/LICENSE +22 -0
- yt_research-0.1.0/PKG-INFO +158 -0
- yt_research-0.1.0/README.md +105 -0
- yt_research-0.1.0/SECURITY.md +16 -0
- yt_research-0.1.0/docs/api-key-setup.md +25 -0
- yt_research-0.1.0/docs/commands.md +45 -0
- yt_research-0.1.0/docs/json-contract.md +31 -0
- yt_research-0.1.0/docs/troubleshooting.md +26 -0
- yt_research-0.1.0/integrations/codex/README.md +15 -0
- yt_research-0.1.0/pyproject.toml +98 -0
- yt_research-0.1.0/src/yt_research/__init__.py +7 -0
- yt_research-0.1.0/src/yt_research/__main__.py +8 -0
- yt_research-0.1.0/src/yt_research/cache.py +91 -0
- yt_research-0.1.0/src/yt_research/cli.py +392 -0
- yt_research-0.1.0/src/yt_research/credentials.py +87 -0
- yt_research-0.1.0/src/yt_research/errors.py +37 -0
- yt_research-0.1.0/src/yt_research/models.py +99 -0
- yt_research-0.1.0/src/yt_research/py.typed +1 -0
- yt_research-0.1.0/src/yt_research/rendering.py +152 -0
- yt_research-0.1.0/src/yt_research/research.py +158 -0
- yt_research-0.1.0/src/yt_research/youtube.py +274 -0
- yt_research-0.1.0/tests/conftest.py +48 -0
- yt_research-0.1.0/tests/test_cache.py +38 -0
- yt_research-0.1.0/tests/test_cli.py +295 -0
- yt_research-0.1.0/tests/test_credentials.py +69 -0
- yt_research-0.1.0/tests/test_models.py +45 -0
- yt_research-0.1.0/tests/test_rendering.py +61 -0
- yt_research-0.1.0/tests/test_research.py +169 -0
- yt_research-0.1.0/tests/test_youtube.py +223 -0
- yt_research-0.1.0/uv.lock +1000 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
concurrency:
|
|
13
|
+
group: ci-${{ github.workflow }}-${{ github.ref }}
|
|
14
|
+
cancel-in-progress: true
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
quality:
|
|
18
|
+
name: Quality
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
|
22
|
+
- uses: astral-sh/setup-uv@d0d8abe699bfb85fec6de9f7adb5ae17292296ff # v6
|
|
23
|
+
with:
|
|
24
|
+
enable-cache: true
|
|
25
|
+
version: "0.11.29"
|
|
26
|
+
- run: uv sync --locked --all-groups
|
|
27
|
+
- run: uv run ruff check .
|
|
28
|
+
- run: uv run ruff format --check .
|
|
29
|
+
- run: uv run mypy
|
|
30
|
+
- run: uv build
|
|
31
|
+
|
|
32
|
+
test:
|
|
33
|
+
name: ${{ matrix.os }} / Python ${{ matrix.python }}
|
|
34
|
+
strategy:
|
|
35
|
+
fail-fast: false
|
|
36
|
+
matrix:
|
|
37
|
+
include:
|
|
38
|
+
- os: ubuntu-latest
|
|
39
|
+
python: "3.11"
|
|
40
|
+
- os: ubuntu-latest
|
|
41
|
+
python: "3.12"
|
|
42
|
+
- os: ubuntu-latest
|
|
43
|
+
python: "3.13"
|
|
44
|
+
- os: ubuntu-latest
|
|
45
|
+
python: "3.14"
|
|
46
|
+
- os: macos-latest
|
|
47
|
+
python: "3.11"
|
|
48
|
+
- os: macos-latest
|
|
49
|
+
python: "3.14"
|
|
50
|
+
runs-on: ${{ matrix.os }}
|
|
51
|
+
steps:
|
|
52
|
+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
|
53
|
+
- uses: astral-sh/setup-uv@d0d8abe699bfb85fec6de9f7adb5ae17292296ff # v6
|
|
54
|
+
with:
|
|
55
|
+
enable-cache: true
|
|
56
|
+
python-version: ${{ matrix.python }}
|
|
57
|
+
version: "0.11.29"
|
|
58
|
+
- run: uv sync --locked --all-groups
|
|
59
|
+
- run: uv run pytest --cov=yt_research --cov-report=term-missing
|
|
60
|
+
- run: uv build
|
|
61
|
+
- name: Smoke test built wheel
|
|
62
|
+
shell: bash
|
|
63
|
+
run: |
|
|
64
|
+
uv venv .smoke
|
|
65
|
+
uv pip install --python .smoke dist/*.whl
|
|
66
|
+
.smoke/bin/yt-research --help
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags: ["v*"]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
|
15
|
+
- uses: astral-sh/setup-uv@d0d8abe699bfb85fec6de9f7adb5ae17292296ff # v6
|
|
16
|
+
with:
|
|
17
|
+
version: "0.11.29"
|
|
18
|
+
- run: uv sync --locked --all-groups
|
|
19
|
+
- name: Verify tag matches package version
|
|
20
|
+
env:
|
|
21
|
+
RELEASE_TAG: ${{ github.ref_name }}
|
|
22
|
+
run: |
|
|
23
|
+
uv run python - <<'PY'
|
|
24
|
+
import os
|
|
25
|
+
import tomllib
|
|
26
|
+
from pathlib import Path
|
|
27
|
+
|
|
28
|
+
version = tomllib.loads(Path("pyproject.toml").read_text())["project"]["version"]
|
|
29
|
+
expected = f"v{version}"
|
|
30
|
+
if os.environ["RELEASE_TAG"] != expected:
|
|
31
|
+
raise SystemExit(f"release tag must be {expected}")
|
|
32
|
+
PY
|
|
33
|
+
- run: uv run ruff check .
|
|
34
|
+
- run: uv run ruff format --check .
|
|
35
|
+
- run: uv run mypy
|
|
36
|
+
- run: uv run pytest
|
|
37
|
+
- run: uv build
|
|
38
|
+
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
|
|
39
|
+
with:
|
|
40
|
+
name: python-distributions
|
|
41
|
+
path: dist/
|
|
42
|
+
if-no-files-found: error
|
|
43
|
+
|
|
44
|
+
publish-pypi:
|
|
45
|
+
needs: build
|
|
46
|
+
runs-on: ubuntu-latest
|
|
47
|
+
environment:
|
|
48
|
+
name: pypi
|
|
49
|
+
url: https://pypi.org/project/yt-research/
|
|
50
|
+
permissions:
|
|
51
|
+
id-token: write
|
|
52
|
+
steps:
|
|
53
|
+
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
|
|
54
|
+
with:
|
|
55
|
+
name: python-distributions
|
|
56
|
+
path: dist/
|
|
57
|
+
- uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
|
|
58
|
+
|
|
59
|
+
github-release:
|
|
60
|
+
needs: publish-pypi
|
|
61
|
+
runs-on: ubuntu-latest
|
|
62
|
+
permissions:
|
|
63
|
+
contents: write
|
|
64
|
+
steps:
|
|
65
|
+
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
|
|
66
|
+
with:
|
|
67
|
+
name: python-distributions
|
|
68
|
+
path: dist/
|
|
69
|
+
- name: Create GitHub release
|
|
70
|
+
env:
|
|
71
|
+
GH_TOKEN: ${{ github.token }}
|
|
72
|
+
run: gh release create "${GITHUB_REF_NAME}" dist/* --generate-notes --verify-tag
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented here. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
4
|
+
|
|
5
|
+
## [Unreleased]
|
|
6
|
+
|
|
7
|
+
## [0.1.0] - 2026-07-31
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- Added `yt-research --version` for checking the installed release.
|
|
12
|
+
- Initial public CLI for researching public YouTube channels and upload histories.
|
|
13
|
+
- Human-readable tables and stable JSON and CSV output.
|
|
14
|
+
- Native secret-store support and an environment variable for headless use.
|
|
15
|
+
- Synthetic test suite and macOS and Linux continuous integration.
|
|
16
|
+
|
|
17
|
+
[Unreleased]: https://github.com/vedntp/yt-research/compare/v0.1.0...HEAD
|
|
18
|
+
[0.1.0]: https://github.com/vedntp/yt-research/releases/tag/v0.1.0
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our pledge
|
|
4
|
+
|
|
5
|
+
We pledge to make participation in this project a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socioeconomic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
|
|
6
|
+
|
|
7
|
+
## Our standards
|
|
8
|
+
|
|
9
|
+
Examples of behavior that contributes to a positive environment include showing empathy, respecting differing viewpoints, accepting constructive feedback, and focusing on what is best for the community.
|
|
10
|
+
|
|
11
|
+
Unacceptable behavior includes sexualized language or imagery, trolling, insulting comments, personal or political attacks, public or private harassment, publishing others' private information, and other conduct that could reasonably be considered inappropriate.
|
|
12
|
+
|
|
13
|
+
## Enforcement
|
|
14
|
+
|
|
15
|
+
Project maintainers may remove, edit, or reject contributions that do not align with this Code of Conduct. Report unacceptable behavior privately using the process in [SECURITY.md](SECURITY.md). Reports will be reviewed promptly and handled with respect for the reporter's privacy and safety.
|
|
16
|
+
|
|
17
|
+
This policy is adapted from Contributor Covenant 2.1.
|
|
18
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Thank you for helping improve `yt-research`.
|
|
4
|
+
|
|
5
|
+
## Development setup
|
|
6
|
+
|
|
7
|
+
Install [uv](https://docs.astral.sh/uv/), clone the repository, and run:
|
|
8
|
+
|
|
9
|
+
```console
|
|
10
|
+
uv sync
|
|
11
|
+
uv run pytest
|
|
12
|
+
uv run ruff check .
|
|
13
|
+
uv run ruff format --check .
|
|
14
|
+
uv run mypy
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Tests must use synthetic data and must not call the live YouTube API. Keep real channel names, credentials, and API responses out of fixtures and bug reports.
|
|
18
|
+
|
|
19
|
+
## Pull requests
|
|
20
|
+
|
|
21
|
+
- Open an issue before large changes so the design can be discussed.
|
|
22
|
+
- Keep each pull request focused and add tests for changed behavior.
|
|
23
|
+
- Update documentation when the public command or output interface changes.
|
|
24
|
+
- Add a changelog entry under `Unreleased` for user-visible changes.
|
|
25
|
+
- Ensure all checks pass on Python 3.11 or newer.
|
|
26
|
+
|
|
27
|
+
By participating, you agree to follow the [Code of Conduct](CODE_OF_CONDUCT.md).
|
|
28
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 vp275
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: yt-research
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Research public YouTube channels from the command line
|
|
5
|
+
Project-URL: Homepage, https://github.com/vedntp/yt-research
|
|
6
|
+
Project-URL: Documentation, https://github.com/vedntp/yt-research/tree/main/docs
|
|
7
|
+
Project-URL: Issues, https://github.com/vedntp/yt-research/issues
|
|
8
|
+
Project-URL: Source, https://github.com/vedntp/yt-research
|
|
9
|
+
Author: vedant
|
|
10
|
+
License: MIT License
|
|
11
|
+
|
|
12
|
+
Copyright (c) 2026 vp275
|
|
13
|
+
|
|
14
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
15
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
16
|
+
in the Software without restriction, including without limitation the rights
|
|
17
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
18
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
19
|
+
furnished to do so, subject to the following conditions:
|
|
20
|
+
|
|
21
|
+
The above copyright notice and this permission notice shall be included in all
|
|
22
|
+
copies or substantial portions of the Software.
|
|
23
|
+
|
|
24
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
25
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
26
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
27
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
28
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
29
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
30
|
+
SOFTWARE.
|
|
31
|
+
|
|
32
|
+
License-File: LICENSE
|
|
33
|
+
Keywords: cli,data-api,research,youtube
|
|
34
|
+
Classifier: Development Status :: 3 - Alpha
|
|
35
|
+
Classifier: Environment :: Console
|
|
36
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
37
|
+
Classifier: Operating System :: MacOS
|
|
38
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
39
|
+
Classifier: Programming Language :: Python :: 3
|
|
40
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
41
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
42
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
43
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
44
|
+
Classifier: Typing :: Typed
|
|
45
|
+
Requires-Python: >=3.11
|
|
46
|
+
Requires-Dist: httpx<1,>=0.27
|
|
47
|
+
Requires-Dist: keyring<27,>=25
|
|
48
|
+
Requires-Dist: platformdirs<5,>=4
|
|
49
|
+
Requires-Dist: pydantic<3,>=2.8
|
|
50
|
+
Requires-Dist: rich<15,>=13.7
|
|
51
|
+
Requires-Dist: typer<1,>=0.12
|
|
52
|
+
Description-Content-Type: text/markdown
|
|
53
|
+
|
|
54
|
+
# yt-research
|
|
55
|
+
|
|
56
|
+
`yt-research` is an open source command-line tool for exploring public YouTube channel metadata and upload histories. It produces readable terminal tables for people and stable JSON or CSV for scripts and agents.
|
|
57
|
+
|
|
58
|
+
> [!IMPORTANT]
|
|
59
|
+
> This project is under active development. Version 0.1.0 is the first public interface and may evolve before 1.0.
|
|
60
|
+
|
|
61
|
+
## What it does
|
|
62
|
+
|
|
63
|
+
- Resolve a channel by handle, channel ID, or channel URL.
|
|
64
|
+
- Search for channel candidates without silently choosing an ambiguous match.
|
|
65
|
+
- Walk a channel's complete public uploads playlist.
|
|
66
|
+
- Filter videos by title text or UTC publication date.
|
|
67
|
+
- Sort by publication date, views, or likes.
|
|
68
|
+
- Export versioned JSON and fixed-column CSV.
|
|
69
|
+
|
|
70
|
+
`yt-research` uses the official YouTube Data API v3. You provide your own API key, and the tool only requests public data.
|
|
71
|
+
|
|
72
|
+
## Install
|
|
73
|
+
|
|
74
|
+
Python 3.11 or newer is required. The supported platforms are macOS and Linux.
|
|
75
|
+
|
|
76
|
+
```console
|
|
77
|
+
pipx install yt-research
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Alternatively, use `uv`:
|
|
81
|
+
|
|
82
|
+
```console
|
|
83
|
+
uv tool install yt-research
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Or run it without a persistent installation:
|
|
87
|
+
|
|
88
|
+
```console
|
|
89
|
+
uvx yt-research --help
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
For a development checkout:
|
|
93
|
+
|
|
94
|
+
```console
|
|
95
|
+
git clone https://github.com/vedntp/yt-research.git
|
|
96
|
+
cd yt-research
|
|
97
|
+
uv sync
|
|
98
|
+
uv run yt-research --help
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Configure an API key
|
|
102
|
+
|
|
103
|
+
Create an API key for the YouTube Data API v3, then store it in your operating system's native secret store:
|
|
104
|
+
|
|
105
|
+
```console
|
|
106
|
+
yt-research auth set
|
|
107
|
+
yt-research auth status
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
For CI or headless Linux, set the environment variable instead:
|
|
111
|
+
|
|
112
|
+
```console
|
|
113
|
+
export YT_RESEARCH_API_KEY="your-api-key"
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
The environment variable takes precedence over the native secret store. See [API key setup](docs/api-key-setup.md) for complete instructions and security guidance.
|
|
117
|
+
|
|
118
|
+
## Quick start
|
|
119
|
+
|
|
120
|
+
Use a fictional placeholder handle in examples, replacing it with the public channel you want to research:
|
|
121
|
+
|
|
122
|
+
```console
|
|
123
|
+
yt-research channel info @examplecreator
|
|
124
|
+
yt-research channel search "Example Creator"
|
|
125
|
+
yt-research videos latest @examplecreator --limit 20
|
|
126
|
+
yt-research videos top @examplecreator --year 2026 --limit 10
|
|
127
|
+
yt-research videos first @examplecreator --match "tutorial"
|
|
128
|
+
yt-research videos list @examplecreator --from 2025-01-01 --format json
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
When stdout is a terminal, results default to a table. Redirected output defaults to JSON:
|
|
132
|
+
|
|
133
|
+
```console
|
|
134
|
+
yt-research videos list @examplecreator > videos.json
|
|
135
|
+
yt-research videos list @examplecreator --format csv --output videos.csv
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Diagnostics and warnings are written to stderr, so JSON and CSV on stdout remain machine-readable.
|
|
139
|
+
|
|
140
|
+
## Documentation
|
|
141
|
+
|
|
142
|
+
- [Command reference](docs/commands.md)
|
|
143
|
+
- [JSON output contract](docs/json-contract.md)
|
|
144
|
+
- [API key setup](docs/api-key-setup.md)
|
|
145
|
+
- [Troubleshooting](docs/troubleshooting.md)
|
|
146
|
+
- [Optional Codex integration](integrations/codex/README.md)
|
|
147
|
+
|
|
148
|
+
## Privacy and limitations
|
|
149
|
+
|
|
150
|
+
The tool does not use OAuth or access private account data. Version 0.1.0 does not download videos, retrieve transcripts or comments, classify Shorts, or run as a hosted service. API calls consume quota from the Google Cloud project associated with your key.
|
|
151
|
+
|
|
152
|
+
## Contributing
|
|
153
|
+
|
|
154
|
+
Contributions are welcome. Read [CONTRIBUTING.md](CONTRIBUTING.md), the [Code of Conduct](CODE_OF_CONDUCT.md), and the [Security Policy](SECURITY.md) before opening a contribution.
|
|
155
|
+
|
|
156
|
+
## License
|
|
157
|
+
|
|
158
|
+
MIT. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# yt-research
|
|
2
|
+
|
|
3
|
+
`yt-research` is an open source command-line tool for exploring public YouTube channel metadata and upload histories. It produces readable terminal tables for people and stable JSON or CSV for scripts and agents.
|
|
4
|
+
|
|
5
|
+
> [!IMPORTANT]
|
|
6
|
+
> This project is under active development. Version 0.1.0 is the first public interface and may evolve before 1.0.
|
|
7
|
+
|
|
8
|
+
## What it does
|
|
9
|
+
|
|
10
|
+
- Resolve a channel by handle, channel ID, or channel URL.
|
|
11
|
+
- Search for channel candidates without silently choosing an ambiguous match.
|
|
12
|
+
- Walk a channel's complete public uploads playlist.
|
|
13
|
+
- Filter videos by title text or UTC publication date.
|
|
14
|
+
- Sort by publication date, views, or likes.
|
|
15
|
+
- Export versioned JSON and fixed-column CSV.
|
|
16
|
+
|
|
17
|
+
`yt-research` uses the official YouTube Data API v3. You provide your own API key, and the tool only requests public data.
|
|
18
|
+
|
|
19
|
+
## Install
|
|
20
|
+
|
|
21
|
+
Python 3.11 or newer is required. The supported platforms are macOS and Linux.
|
|
22
|
+
|
|
23
|
+
```console
|
|
24
|
+
pipx install yt-research
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Alternatively, use `uv`:
|
|
28
|
+
|
|
29
|
+
```console
|
|
30
|
+
uv tool install yt-research
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Or run it without a persistent installation:
|
|
34
|
+
|
|
35
|
+
```console
|
|
36
|
+
uvx yt-research --help
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
For a development checkout:
|
|
40
|
+
|
|
41
|
+
```console
|
|
42
|
+
git clone https://github.com/vedntp/yt-research.git
|
|
43
|
+
cd yt-research
|
|
44
|
+
uv sync
|
|
45
|
+
uv run yt-research --help
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Configure an API key
|
|
49
|
+
|
|
50
|
+
Create an API key for the YouTube Data API v3, then store it in your operating system's native secret store:
|
|
51
|
+
|
|
52
|
+
```console
|
|
53
|
+
yt-research auth set
|
|
54
|
+
yt-research auth status
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
For CI or headless Linux, set the environment variable instead:
|
|
58
|
+
|
|
59
|
+
```console
|
|
60
|
+
export YT_RESEARCH_API_KEY="your-api-key"
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
The environment variable takes precedence over the native secret store. See [API key setup](docs/api-key-setup.md) for complete instructions and security guidance.
|
|
64
|
+
|
|
65
|
+
## Quick start
|
|
66
|
+
|
|
67
|
+
Use a fictional placeholder handle in examples, replacing it with the public channel you want to research:
|
|
68
|
+
|
|
69
|
+
```console
|
|
70
|
+
yt-research channel info @examplecreator
|
|
71
|
+
yt-research channel search "Example Creator"
|
|
72
|
+
yt-research videos latest @examplecreator --limit 20
|
|
73
|
+
yt-research videos top @examplecreator --year 2026 --limit 10
|
|
74
|
+
yt-research videos first @examplecreator --match "tutorial"
|
|
75
|
+
yt-research videos list @examplecreator --from 2025-01-01 --format json
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
When stdout is a terminal, results default to a table. Redirected output defaults to JSON:
|
|
79
|
+
|
|
80
|
+
```console
|
|
81
|
+
yt-research videos list @examplecreator > videos.json
|
|
82
|
+
yt-research videos list @examplecreator --format csv --output videos.csv
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Diagnostics and warnings are written to stderr, so JSON and CSV on stdout remain machine-readable.
|
|
86
|
+
|
|
87
|
+
## Documentation
|
|
88
|
+
|
|
89
|
+
- [Command reference](docs/commands.md)
|
|
90
|
+
- [JSON output contract](docs/json-contract.md)
|
|
91
|
+
- [API key setup](docs/api-key-setup.md)
|
|
92
|
+
- [Troubleshooting](docs/troubleshooting.md)
|
|
93
|
+
- [Optional Codex integration](integrations/codex/README.md)
|
|
94
|
+
|
|
95
|
+
## Privacy and limitations
|
|
96
|
+
|
|
97
|
+
The tool does not use OAuth or access private account data. Version 0.1.0 does not download videos, retrieve transcripts or comments, classify Shorts, or run as a hosted service. API calls consume quota from the Google Cloud project associated with your key.
|
|
98
|
+
|
|
99
|
+
## Contributing
|
|
100
|
+
|
|
101
|
+
Contributions are welcome. Read [CONTRIBUTING.md](CONTRIBUTING.md), the [Code of Conduct](CODE_OF_CONDUCT.md), and the [Security Policy](SECURITY.md) before opening a contribution.
|
|
102
|
+
|
|
103
|
+
## License
|
|
104
|
+
|
|
105
|
+
MIT. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported versions
|
|
4
|
+
|
|
5
|
+
Security fixes are provided for the latest released minor version.
|
|
6
|
+
|
|
7
|
+
## Reporting a vulnerability
|
|
8
|
+
|
|
9
|
+
Do not open a public issue for a suspected vulnerability or exposed credential. Use GitHub's private vulnerability reporting feature on the repository Security tab. Include reproduction steps, affected versions, impact, and any suggested mitigation.
|
|
10
|
+
|
|
11
|
+
You can expect acknowledgement within seven days. Please allow time for investigation and a coordinated release before public disclosure.
|
|
12
|
+
|
|
13
|
+
## Credential safety
|
|
14
|
+
|
|
15
|
+
Never include a YouTube API key in an issue, test fixture, screenshot, log, or pull request. If a key is exposed, revoke it immediately in Google Cloud Console and create a replacement.
|
|
16
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# API key setup
|
|
2
|
+
|
|
3
|
+
`yt-research` requires a YouTube Data API v3 key for public API requests.
|
|
4
|
+
|
|
5
|
+
1. Create or select a project in Google Cloud Console.
|
|
6
|
+
2. Enable **YouTube Data API v3** for the project.
|
|
7
|
+
3. Create an API key under **APIs & Services > Credentials**.
|
|
8
|
+
4. Restrict the key to the YouTube Data API v3. Apply any additional restrictions that fit your environment.
|
|
9
|
+
5. Run `yt-research auth set` and paste the key into the hidden prompt.
|
|
10
|
+
|
|
11
|
+
Check or remove the stored credential with:
|
|
12
|
+
|
|
13
|
+
```console
|
|
14
|
+
yt-research auth status
|
|
15
|
+
yt-research auth delete
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
On a headless Linux host without a native keyring, use an environment variable:
|
|
19
|
+
|
|
20
|
+
```console
|
|
21
|
+
export YT_RESEARCH_API_KEY="your-api-key"
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
The environment variable takes precedence over the keyring. Avoid placing it in shell history, committed environment files, or CI logs. Use your CI provider's encrypted secret storage.
|
|
25
|
+
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Command reference
|
|
2
|
+
|
|
3
|
+
Run `yt-research COMMAND --help` for the authoritative options installed with your version.
|
|
4
|
+
|
|
5
|
+
## Authentication
|
|
6
|
+
|
|
7
|
+
- `auth set` stores an API key in the native secret store.
|
|
8
|
+
- `auth status` reports whether a key is available and where it came from, without displaying it.
|
|
9
|
+
- `auth delete` removes the key from the native secret store.
|
|
10
|
+
|
|
11
|
+
## Channels
|
|
12
|
+
|
|
13
|
+
- `channel info CHANNEL` retrieves public channel metadata. `CHANNEL` may be a handle, channel ID, or supported channel URL.
|
|
14
|
+
- `channel search QUERY` returns channel candidates. It never silently selects one.
|
|
15
|
+
|
|
16
|
+
## Videos
|
|
17
|
+
|
|
18
|
+
- `videos list CHANNEL` lists all matching uploads, newest first by default.
|
|
19
|
+
- `videos latest CHANNEL` returns the newest matching uploads, 20 by default.
|
|
20
|
+
- `videos top CHANNEL` returns the most-viewed matching uploads, 10 by default.
|
|
21
|
+
- `videos first CHANNEL` returns the oldest matching upload.
|
|
22
|
+
|
|
23
|
+
Video commands accept:
|
|
24
|
+
|
|
25
|
+
- `--match TEXT` for case-insensitive title substring matching.
|
|
26
|
+
- `--year YYYY`, or the mutually exclusive `--from YYYY-MM-DD` and `--to YYYY-MM-DD` UTC boundaries.
|
|
27
|
+
- `--sort published-asc|published-desc|views|likes`.
|
|
28
|
+
- `--limit N`.
|
|
29
|
+
- `--format table|json|csv`.
|
|
30
|
+
- `--output PATH` to write the result to a file.
|
|
31
|
+
- `--refresh` to bypass cached channel identity data.
|
|
32
|
+
- `--no-color` to disable terminal styling.
|
|
33
|
+
|
|
34
|
+
Plain channel names are intentionally rejected by research commands. Use `channel search`, then pass an exact handle or ID.
|
|
35
|
+
|
|
36
|
+
## Exit codes
|
|
37
|
+
|
|
38
|
+
| Code | Meaning |
|
|
39
|
+
| ---: | --- |
|
|
40
|
+
| 0 | Success |
|
|
41
|
+
| 2 | Invalid arguments |
|
|
42
|
+
| 3 | Missing or rejected credentials |
|
|
43
|
+
| 4 | Channel or video not found, or ambiguous input |
|
|
44
|
+
| 5 | Network, quota, or upstream YouTube failure |
|
|
45
|
+
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# JSON output contract
|
|
2
|
+
|
|
3
|
+
JSON output is intended for scripts and agents. Version 0.1.0 emits `schema_version: 1` and writes diagnostics only to stderr.
|
|
4
|
+
|
|
5
|
+
```json
|
|
6
|
+
{
|
|
7
|
+
"schema_version": 1,
|
|
8
|
+
"command": "videos.top",
|
|
9
|
+
"fetched_at": "2026-07-17T12:00:00Z",
|
|
10
|
+
"channel": {},
|
|
11
|
+
"query": {},
|
|
12
|
+
"items": [],
|
|
13
|
+
"meta": {
|
|
14
|
+
"matched": 0,
|
|
15
|
+
"returned": 0,
|
|
16
|
+
"requests": {},
|
|
17
|
+
"warnings": []
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Consumers may ignore unknown object properties. A future incompatible change will increment `schema_version`. Optional API statistics, such as likes or comments, are `null` when unavailable. An absent optional statistic does not remove the video from `items`.
|
|
23
|
+
|
|
24
|
+
Timestamps use ISO 8601 in UTC. Request counts are estimates grouped by endpoint, not authoritative remaining Google quota.
|
|
25
|
+
|
|
26
|
+
CSV output has these fixed columns:
|
|
27
|
+
|
|
28
|
+
```text
|
|
29
|
+
video_id,title,url,published_at,duration_seconds,views,likes,comments
|
|
30
|
+
```
|
|
31
|
+
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Troubleshooting
|
|
2
|
+
|
|
3
|
+
## No API key is available
|
|
4
|
+
|
|
5
|
+
Run `yt-research auth set`. On headless Linux, set `YT_RESEARCH_API_KEY` in the process environment instead.
|
|
6
|
+
|
|
7
|
+
## The API rejects the key
|
|
8
|
+
|
|
9
|
+
Confirm that YouTube Data API v3 is enabled in the key's Google Cloud project and that API restrictions allow it. Revoke and replace any key that may have been exposed.
|
|
10
|
+
|
|
11
|
+
## Quota has been exceeded
|
|
12
|
+
|
|
13
|
+
Quota is managed by Google Cloud. Wait for quota reset or review the project's quota allocation. `yt-research` reports request estimates but cannot determine the authoritative quota remaining.
|
|
14
|
+
|
|
15
|
+
## A channel name is ambiguous
|
|
16
|
+
|
|
17
|
+
Research commands require a channel handle, channel ID, or supported URL. Run `yt-research channel search "name"`, inspect the candidates, and retry with the exact handle or ID.
|
|
18
|
+
|
|
19
|
+
## A statistic is null
|
|
20
|
+
|
|
21
|
+
YouTube may hide or omit likes, comments, or subscriber counts. The tool preserves the record and represents the unavailable value as `null`.
|
|
22
|
+
|
|
23
|
+
## Results appear stale
|
|
24
|
+
|
|
25
|
+
Live video and channel statistics are fetched for each research operation. If a channel identity has changed, add `--refresh` to bypass the local identity cache.
|
|
26
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Codex integration
|
|
2
|
+
|
|
3
|
+
Codex can call `yt-research` as a local research tool. This integration is optional and never modifies global Codex configuration automatically.
|
|
4
|
+
|
|
5
|
+
1. Install and configure `yt-research`.
|
|
6
|
+
2. Copy the sample instructions below into the relevant workspace `AGENTS.md`, adapting them to your project.
|
|
7
|
+
3. Ensure the Codex process can access `YT_RESEARCH_API_KEY` or the native secret store.
|
|
8
|
+
|
|
9
|
+
```markdown
|
|
10
|
+
## YouTube research
|
|
11
|
+
|
|
12
|
+
Use the relevant `yt-research` command with `--format json` for public YouTube channel and upload-history research, for example `yt-research videos list @channelhandle --format json`. Pass an exact channel handle, ID, or URL. Use `yt-research channel search` only when the user supplied an ambiguous channel name. Treat stdout as structured data and stderr as diagnostics.
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Do not ask Codex to expose, print, or persist the API key.
|