getyoutubetranscript 0.3.0__tar.gz → 0.3.1__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.
- {getyoutubetranscript-0.3.0 → getyoutubetranscript-0.3.1}/PKG-INFO +5 -4
- {getyoutubetranscript-0.3.0 → getyoutubetranscript-0.3.1}/README.md +4 -3
- {getyoutubetranscript-0.3.0 → getyoutubetranscript-0.3.1}/pyproject.toml +1 -1
- {getyoutubetranscript-0.3.0 → getyoutubetranscript-0.3.1}/src/getyoutubetranscript/__init__.py +1 -1
- {getyoutubetranscript-0.3.0 → getyoutubetranscript-0.3.1}/src/getyoutubetranscript/client.py +5 -4
- {getyoutubetranscript-0.3.0 → getyoutubetranscript-0.3.1}/tests/live/test_live_api.py +12 -0
- {getyoutubetranscript-0.3.0 → getyoutubetranscript-0.3.1}/.github/workflows/tests.yml +0 -0
- {getyoutubetranscript-0.3.0 → getyoutubetranscript-0.3.1}/.gitignore +0 -0
- {getyoutubetranscript-0.3.0 → getyoutubetranscript-0.3.1}/LICENSE +0 -0
- {getyoutubetranscript-0.3.0 → getyoutubetranscript-0.3.1}/src/getyoutubetranscript/__main__.py +0 -0
- {getyoutubetranscript-0.3.0 → getyoutubetranscript-0.3.1}/src/getyoutubetranscript/cli.py +0 -0
- {getyoutubetranscript-0.3.0 → getyoutubetranscript-0.3.1}/src/getyoutubetranscript/exceptions.py +0 -0
- {getyoutubetranscript-0.3.0 → getyoutubetranscript-0.3.1}/src/getyoutubetranscript/formatters.py +0 -0
- {getyoutubetranscript-0.3.0 → getyoutubetranscript-0.3.1}/src/getyoutubetranscript/py.typed +0 -0
- {getyoutubetranscript-0.3.0 → getyoutubetranscript-0.3.1}/src/getyoutubetranscript/types.py +0 -0
- {getyoutubetranscript-0.3.0 → getyoutubetranscript-0.3.1}/tests/live/__init__.py +0 -0
- {getyoutubetranscript-0.3.0 → getyoutubetranscript-0.3.1}/tests/test_cli.py +0 -0
- {getyoutubetranscript-0.3.0 → getyoutubetranscript-0.3.1}/tests/test_client.py +0 -0
- {getyoutubetranscript-0.3.0 → getyoutubetranscript-0.3.1}/tests/test_formatters.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: getyoutubetranscript
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.1
|
|
4
4
|
Summary: YouTube transcript API for Python: get YouTube video transcripts, captions and subtitles with timestamps, search YouTube, and list channel and playlist videos. No proxies or headless browser.
|
|
5
5
|
Project-URL: Homepage, https://getyoutubetranscript.com
|
|
6
6
|
Project-URL: Documentation, https://getyoutubetranscript.com/docs
|
|
@@ -125,10 +125,11 @@ print(to_text(result)) # one block of plain text
|
|
|
125
125
|
### Search
|
|
126
126
|
|
|
127
127
|
```python
|
|
128
|
-
client.search("lofi beats", type="video", limit=10)
|
|
128
|
+
first_page = client.search("lofi beats", type="video", limit=10)
|
|
129
129
|
|
|
130
|
-
# Pagination
|
|
131
|
-
|
|
130
|
+
# Pagination: pass continuation_token back as page_token
|
|
131
|
+
if first_page.get("continuation_token"):
|
|
132
|
+
page2 = client.search(page_token=first_page["continuation_token"])
|
|
132
133
|
```
|
|
133
134
|
|
|
134
135
|
### Channels
|
|
@@ -88,10 +88,11 @@ print(to_text(result)) # one block of plain text
|
|
|
88
88
|
### Search
|
|
89
89
|
|
|
90
90
|
```python
|
|
91
|
-
client.search("lofi beats", type="video", limit=10)
|
|
91
|
+
first_page = client.search("lofi beats", type="video", limit=10)
|
|
92
92
|
|
|
93
|
-
# Pagination
|
|
94
|
-
|
|
93
|
+
# Pagination: pass continuation_token back as page_token
|
|
94
|
+
if first_page.get("continuation_token"):
|
|
95
|
+
page2 = client.search(page_token=first_page["continuation_token"])
|
|
95
96
|
```
|
|
96
97
|
|
|
97
98
|
### Channels
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "getyoutubetranscript"
|
|
7
|
-
version = "0.3.
|
|
7
|
+
version = "0.3.1"
|
|
8
8
|
description = "YouTube transcript API for Python: get YouTube video transcripts, captions and subtitles with timestamps, search YouTube, and list channel and playlist videos. No proxies or headless browser."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
{getyoutubetranscript-0.3.0 → getyoutubetranscript-0.3.1}/src/getyoutubetranscript/__init__.py
RENAMED
|
@@ -13,7 +13,7 @@ from .exceptions import GetYouTubeTranscriptError
|
|
|
13
13
|
from .formatters import format_transcript, to_json, to_srt, to_text, to_timed_text, to_vtt
|
|
14
14
|
from .types import Segment, TranscriptData
|
|
15
15
|
|
|
16
|
-
__version__ = "0.3.
|
|
16
|
+
__version__ = "0.3.1"
|
|
17
17
|
|
|
18
18
|
__all__ = [
|
|
19
19
|
"Client",
|
{getyoutubetranscript-0.3.0 → getyoutubetranscript-0.3.1}/src/getyoutubetranscript/client.py
RENAMED
|
@@ -184,9 +184,9 @@ class Client:
|
|
|
184
184
|
Args:
|
|
185
185
|
query: Search query. Required for a first page unless
|
|
186
186
|
``page_token`` is given.
|
|
187
|
-
page_token:
|
|
188
|
-
|
|
189
|
-
|
|
187
|
+
page_token: The ``continuation_token`` from a previous response,
|
|
188
|
+
to fetch the next page. Treat as opaque - don't construct it
|
|
189
|
+
yourself. Expires after 24 hours.
|
|
190
190
|
type: Restrict results to ``"video"`` (default) or ``"channel"``.
|
|
191
191
|
Never mixes both kinds in one response.
|
|
192
192
|
country: Two-letter region code, e.g. ``"us"``.
|
|
@@ -196,7 +196,8 @@ class Client:
|
|
|
196
196
|
Returns:
|
|
197
197
|
dict with ``query``, and either ``video_results`` or
|
|
198
198
|
``channel_results`` depending on ``type``, plus
|
|
199
|
-
``
|
|
199
|
+
``continuation_token`` for the next page (missing or ``None`` when
|
|
200
|
+
there are no more pages, so read it with ``.get()``).
|
|
200
201
|
|
|
201
202
|
Raises:
|
|
202
203
|
ValueError: if neither ``query`` nor ``page_token`` is given.
|
|
@@ -71,6 +71,18 @@ def test_search_live(client: Client):
|
|
|
71
71
|
assert len(result["video_results"]) > 0
|
|
72
72
|
|
|
73
73
|
|
|
74
|
+
def test_search_pagination_live(client: Client):
|
|
75
|
+
"""The README pagination example: continuation_token goes back in as page_token."""
|
|
76
|
+
first_page = client.search("lofi beats", type="video", limit=10)
|
|
77
|
+
assert "pagination" not in first_page
|
|
78
|
+
token = first_page.get("continuation_token")
|
|
79
|
+
assert token, "first page should offer a next page"
|
|
80
|
+
page2 = client.search(page_token=token)
|
|
81
|
+
assert page2["video_results"]
|
|
82
|
+
first_titles = {v.get("title") for v in first_page["video_results"]}
|
|
83
|
+
assert not first_titles & {v.get("title") for v in page2["video_results"]}
|
|
84
|
+
|
|
85
|
+
|
|
74
86
|
def test_get_credits_live(client: Client):
|
|
75
87
|
"""Free endpoint - safe to run often."""
|
|
76
88
|
result = client.get_credits()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{getyoutubetranscript-0.3.0 → getyoutubetranscript-0.3.1}/src/getyoutubetranscript/__main__.py
RENAMED
|
File without changes
|
|
File without changes
|
{getyoutubetranscript-0.3.0 → getyoutubetranscript-0.3.1}/src/getyoutubetranscript/exceptions.py
RENAMED
|
File without changes
|
{getyoutubetranscript-0.3.0 → getyoutubetranscript-0.3.1}/src/getyoutubetranscript/formatters.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|