yt-search-py 1.0.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_search_py-1.0.0/LICENSE +21 -0
- yt_search_py-1.0.0/MANIFEST.in +6 -0
- yt_search_py-1.0.0/PKG-INFO +107 -0
- yt_search_py-1.0.0/README.md +77 -0
- yt_search_py-1.0.0/pyproject.toml +46 -0
- yt_search_py-1.0.0/setup.cfg +4 -0
- yt_search_py-1.0.0/ytSearch/__init__.py +9 -0
- yt_search_py-1.0.0/ytSearch/core/constants.py +74 -0
- yt_search_py-1.0.0/ytSearch/core/handlers.py +337 -0
- yt_search_py-1.0.0/ytSearch/core/requests.py +43 -0
- yt_search_py-1.0.0/ytSearch/core/search.py +135 -0
- yt_search_py-1.0.0/ytSearch/playlist.py +340 -0
- yt_search_py-1.0.0/ytSearch/search.py +338 -0
- yt_search_py-1.0.0/yt_search_py.egg-info/PKG-INFO +107 -0
- yt_search_py-1.0.0/yt_search_py.egg-info/SOURCES.txt +16 -0
- yt_search_py-1.0.0/yt_search_py.egg-info/dependency_links.txt +1 -0
- yt_search_py-1.0.0/yt_search_py.egg-info/requires.txt +1 -0
- yt_search_py-1.0.0/yt_search_py.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Sparrow
|
|
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.
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: yt-search-py
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Lightweight YouTube search library with async support - Search for videos, channels, playlists and get playlist details
|
|
5
|
+
Author-email: Sparrow <108956698+sparrow9616@users.noreply.github.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/sparrow9616/yt-search
|
|
8
|
+
Project-URL: Documentation, https://github.com/sparrow9616/yt-search/blob/main/README.md
|
|
9
|
+
Project-URL: Repository, https://github.com/sparrow9616/yt-search
|
|
10
|
+
Project-URL: Bug Tracker, https://github.com/sparrow9616/yt-search/issues
|
|
11
|
+
Keywords: youtube,search,youtube-search,playlist,async,youtube-api
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Operating System :: OS Independent
|
|
22
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
|
+
Classifier: Topic :: Multimedia :: Video
|
|
24
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
25
|
+
Requires-Python: >=3.7
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Dist: httpx>=0.28.1
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
|
|
31
|
+
# YT Search
|
|
32
|
+
|
|
33
|
+
A lightweight, modern YouTube search library with async/await support. Search for videos, channels, playlists, and retrieve complete playlist information with ease.
|
|
34
|
+
|
|
35
|
+
[](https://pypi.org/project/yt-search-lite/)
|
|
36
|
+
[](https://pypi.org/project/yt-search-lite/)
|
|
37
|
+
[](LICENSE)
|
|
38
|
+
|
|
39
|
+
## Features
|
|
40
|
+
|
|
41
|
+
β¨ **Search Functionality**
|
|
42
|
+
- π₯ Search for videos with filters
|
|
43
|
+
- π€ Search for channels
|
|
44
|
+
- π Search for playlists
|
|
45
|
+
- π Custom search with sorting options
|
|
46
|
+
- π Pagination support
|
|
47
|
+
|
|
48
|
+
β¨ **Playlist Features**
|
|
49
|
+
- π Get full playlist information with videos
|
|
50
|
+
- βΉοΈ Get playlist metadata only
|
|
51
|
+
- π¬ Get playlist videos only
|
|
52
|
+
- βΎοΈ Pagination for large playlists (100+ videos)
|
|
53
|
+
|
|
54
|
+
β¨ **Modern API**
|
|
55
|
+
- β‘ Async/await support
|
|
56
|
+
- π― Type hints
|
|
57
|
+
- π Fast and lightweight
|
|
58
|
+
- π‘οΈ No API key required
|
|
59
|
+
|
|
60
|
+
## Installation
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pip install yt-search
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Quick Start
|
|
67
|
+
|
|
68
|
+
### Search for Videos
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
import asyncio
|
|
72
|
+
from ytSearch import VideosSearch
|
|
73
|
+
|
|
74
|
+
async def main():
|
|
75
|
+
search = VideosSearch('Python tutorials', limit=5)
|
|
76
|
+
result = await search.next()
|
|
77
|
+
|
|
78
|
+
for video in result['result']:
|
|
79
|
+
print(f"{video['title']} - {video['link']}")
|
|
80
|
+
|
|
81
|
+
asyncio.run(main())
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Get Playlist Information
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
import asyncio
|
|
88
|
+
from ytSearch import Playlist
|
|
89
|
+
|
|
90
|
+
async def main():
|
|
91
|
+
# Get full playlist with videos
|
|
92
|
+
playlist = await Playlist.get('https://www.youtube.com/playlist?list=PLRBp0Fe2GpgmsW46rJyudVFlY6IYjFBIK')
|
|
93
|
+
|
|
94
|
+
print(f"Playlist: {playlist['info']['title']}")
|
|
95
|
+
print(f"Videos: {len(playlist['videos'])}")
|
|
96
|
+
|
|
97
|
+
asyncio.run(main())
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Requirements
|
|
101
|
+
|
|
102
|
+
- Python 3.7+
|
|
103
|
+
- httpx >= 0.28.1
|
|
104
|
+
|
|
105
|
+
## License
|
|
106
|
+
|
|
107
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# YT Search
|
|
2
|
+
|
|
3
|
+
A lightweight, modern YouTube search library with async/await support. Search for videos, channels, playlists, and retrieve complete playlist information with ease.
|
|
4
|
+
|
|
5
|
+
[](https://pypi.org/project/yt-search-lite/)
|
|
6
|
+
[](https://pypi.org/project/yt-search-lite/)
|
|
7
|
+
[](LICENSE)
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
β¨ **Search Functionality**
|
|
12
|
+
- π₯ Search for videos with filters
|
|
13
|
+
- π€ Search for channels
|
|
14
|
+
- π Search for playlists
|
|
15
|
+
- π Custom search with sorting options
|
|
16
|
+
- π Pagination support
|
|
17
|
+
|
|
18
|
+
β¨ **Playlist Features**
|
|
19
|
+
- π Get full playlist information with videos
|
|
20
|
+
- βΉοΈ Get playlist metadata only
|
|
21
|
+
- π¬ Get playlist videos only
|
|
22
|
+
- βΎοΈ Pagination for large playlists (100+ videos)
|
|
23
|
+
|
|
24
|
+
β¨ **Modern API**
|
|
25
|
+
- β‘ Async/await support
|
|
26
|
+
- π― Type hints
|
|
27
|
+
- π Fast and lightweight
|
|
28
|
+
- π‘οΈ No API key required
|
|
29
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
pip install yt-search
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Quick Start
|
|
37
|
+
|
|
38
|
+
### Search for Videos
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
import asyncio
|
|
42
|
+
from ytSearch import VideosSearch
|
|
43
|
+
|
|
44
|
+
async def main():
|
|
45
|
+
search = VideosSearch('Python tutorials', limit=5)
|
|
46
|
+
result = await search.next()
|
|
47
|
+
|
|
48
|
+
for video in result['result']:
|
|
49
|
+
print(f"{video['title']} - {video['link']}")
|
|
50
|
+
|
|
51
|
+
asyncio.run(main())
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Get Playlist Information
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
import asyncio
|
|
58
|
+
from ytSearch import Playlist
|
|
59
|
+
|
|
60
|
+
async def main():
|
|
61
|
+
# Get full playlist with videos
|
|
62
|
+
playlist = await Playlist.get('https://www.youtube.com/playlist?list=PLRBp0Fe2GpgmsW46rJyudVFlY6IYjFBIK')
|
|
63
|
+
|
|
64
|
+
print(f"Playlist: {playlist['info']['title']}")
|
|
65
|
+
print(f"Videos: {len(playlist['videos'])}")
|
|
66
|
+
|
|
67
|
+
asyncio.run(main())
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Requirements
|
|
71
|
+
|
|
72
|
+
- Python 3.7+
|
|
73
|
+
- httpx >= 0.28.1
|
|
74
|
+
|
|
75
|
+
## License
|
|
76
|
+
|
|
77
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "yt-search-py"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "Lightweight YouTube search library with async support - Search for videos, channels, playlists and get playlist details"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.7"
|
|
11
|
+
license = {text = "MIT"}
|
|
12
|
+
keywords = ["youtube", "search", "youtube-search", "playlist", "async", "youtube-api"]
|
|
13
|
+
authors = [
|
|
14
|
+
{name = "Sparrow", email = "108956698+sparrow9616@users.noreply.github.com"}
|
|
15
|
+
]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 4 - Beta",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"License :: OSI Approved :: MIT License",
|
|
20
|
+
"Programming Language :: Python :: 3.8",
|
|
21
|
+
"Programming Language :: Python :: 3.9",
|
|
22
|
+
"Programming Language :: Python :: 3.10",
|
|
23
|
+
"Programming Language :: Python :: 3.11",
|
|
24
|
+
"Programming Language :: Python :: 3.12",
|
|
25
|
+
"Programming Language :: Python :: 3.13",
|
|
26
|
+
"Operating System :: OS Independent",
|
|
27
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
28
|
+
"Topic :: Multimedia :: Video",
|
|
29
|
+
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
|
|
30
|
+
]
|
|
31
|
+
dependencies = [
|
|
32
|
+
"httpx>=0.28.1",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
[project.urls]
|
|
36
|
+
Homepage = "https://github.com/sparrow9616/yt-search"
|
|
37
|
+
Documentation = "https://github.com/sparrow9616/yt-search/blob/main/README.md"
|
|
38
|
+
Repository = "https://github.com/sparrow9616/yt-search"
|
|
39
|
+
"Bug Tracker" = "https://github.com/sparrow9616/yt-search/issues"
|
|
40
|
+
|
|
41
|
+
[tool.setuptools.packages.find]
|
|
42
|
+
include = ["ytSearch*"]
|
|
43
|
+
exclude = ["tests*", "examples*"]
|
|
44
|
+
|
|
45
|
+
[tool.setuptools.package-data]
|
|
46
|
+
ytSearch = ["py.typed"]
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
requestPayload = {
|
|
2
|
+
"context": {
|
|
3
|
+
"client": {
|
|
4
|
+
"clientName": "WEB",
|
|
5
|
+
"clientVersion": "2.20210224.06.00",
|
|
6
|
+
"newVisitorCookie": True,
|
|
7
|
+
},
|
|
8
|
+
"user": {
|
|
9
|
+
"lockedSafetyMode": False,
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
userAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36'
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
videoElementKey = 'videoRenderer'
|
|
17
|
+
channelElementKey = 'channelRenderer'
|
|
18
|
+
playlistElementKey = 'playlistRenderer'
|
|
19
|
+
shelfElementKey = 'shelfRenderer'
|
|
20
|
+
itemSectionKey = 'itemSectionRenderer'
|
|
21
|
+
continuationItemKey = 'continuationItemRenderer'
|
|
22
|
+
playerResponseKey = 'playerResponse'
|
|
23
|
+
richItemKey = 'richItemRenderer'
|
|
24
|
+
hashtagElementKey = 'hashtagTileRenderer'
|
|
25
|
+
hashtagBrowseKey = 'FEhashtag'
|
|
26
|
+
hashtagVideosPath = ['contents', 'twoColumnBrowseResultsRenderer', 'tabs', 0, 'tabRenderer', 'content', 'richGridRenderer', 'contents']
|
|
27
|
+
hashtagContinuationVideosPath = ['onResponseReceivedActions', 0, 'appendContinuationItemsAction', 'continuationItems']
|
|
28
|
+
searchKey = 'AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8'
|
|
29
|
+
contentPath = ['contents', 'twoColumnSearchResultsRenderer', 'primaryContents', 'sectionListRenderer', 'contents']
|
|
30
|
+
fallbackContentPath = ['contents', 'twoColumnSearchResultsRenderer', 'primaryContents', 'richGridRenderer', 'contents']
|
|
31
|
+
continuationContentPath = ['onResponseReceivedCommands', 0, 'appendContinuationItemsAction', 'continuationItems']
|
|
32
|
+
continuationKeyPath = ['continuationItemRenderer', 'continuationEndpoint', 'continuationCommand', 'token']
|
|
33
|
+
playlistInfoPath = ['response', 'sidebar', 'playlistSidebarRenderer', 'items']
|
|
34
|
+
playlistVideosPath = ['response', 'contents', 'twoColumnBrowseResultsRenderer', 'tabs', 0, 'tabRenderer', 'content', 'sectionListRenderer', 'contents', 0, 'itemSectionRenderer', 'contents', 0, 'playlistVideoListRenderer', 'contents']
|
|
35
|
+
playlistPrimaryInfoKey = 'playlistSidebarPrimaryInfoRenderer'
|
|
36
|
+
playlistSecondaryInfoKey = 'playlistSidebarSecondaryInfoRenderer'
|
|
37
|
+
playlistVideoKey = 'playlistVideoRenderer'
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class ResultMode:
|
|
41
|
+
json = 0
|
|
42
|
+
dict = 1
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class SearchMode:
|
|
46
|
+
videos = 'EgIQAQ%3D%3D'
|
|
47
|
+
channels = 'EgIQAg%3D%3D'
|
|
48
|
+
playlists = 'EgIQAw%3D%3D'
|
|
49
|
+
livestreams = 'EgJAAQ%3D%3D'
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class VideoUploadDateFilter:
|
|
53
|
+
lastHour = 'EgQIARAB'
|
|
54
|
+
today = 'EgQIAhAB'
|
|
55
|
+
thisWeek = 'EgQIAxAB'
|
|
56
|
+
thisMonth = 'EgQIBBAB'
|
|
57
|
+
thisYear = 'EgQIBRAB'
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
class VideoDurationFilter:
|
|
61
|
+
short = 'EgQQARgB'
|
|
62
|
+
long = 'EgQQARgC'
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class VideoSortOrder:
|
|
66
|
+
relevance = 'CAASAhAB'
|
|
67
|
+
uploadDate = 'CAISAhAB'
|
|
68
|
+
viewCount = 'CAMSAhAB'
|
|
69
|
+
rating = 'CAESAhAB'
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
class ChannelRequestType:
|
|
73
|
+
info = "EgVhYm91dA%3D%3D"
|
|
74
|
+
playlists = "EglwbGF5bGlzdHMYAyABcAA%3D"
|