py-youtube-search 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.
- py_youtube_search-0.1.0/PKG-INFO +144 -0
- py_youtube_search-0.1.0/README.md +123 -0
- py_youtube_search-0.1.0/py_youtube_search/__init__.py +66 -0
- py_youtube_search-0.1.0/py_youtube_search.egg-info/PKG-INFO +144 -0
- py_youtube_search-0.1.0/py_youtube_search.egg-info/SOURCES.txt +7 -0
- py_youtube_search-0.1.0/py_youtube_search.egg-info/dependency_links.txt +1 -0
- py_youtube_search-0.1.0/py_youtube_search.egg-info/top_level.txt +1 -0
- py_youtube_search-0.1.0/setup.cfg +4 -0
- py_youtube_search-0.1.0/setup.py +22 -0
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: py-youtube-search
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A lightweight, regex-based YouTube search library without API keys.
|
|
5
|
+
Home-page: https://github.com/yourusername/py-youtube-search
|
|
6
|
+
Author: Your Name
|
|
7
|
+
Author-email: your.email@example.com
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.6
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
Dynamic: author
|
|
14
|
+
Dynamic: author-email
|
|
15
|
+
Dynamic: classifier
|
|
16
|
+
Dynamic: description
|
|
17
|
+
Dynamic: description-content-type
|
|
18
|
+
Dynamic: home-page
|
|
19
|
+
Dynamic: requires-python
|
|
20
|
+
Dynamic: summary
|
|
21
|
+
|
|
22
|
+
# py-youtube-search
|
|
23
|
+
|
|
24
|
+
A lightweight, zero-dependency Python library to search YouTube videos programmatically without an API key. This library uses standard Python libraries (`urllib` and `re`) to scrape search results, making it fast, robust, and easy to integrate into any project.
|
|
25
|
+
|
|
26
|
+
## Features
|
|
27
|
+
|
|
28
|
+
- **No API Key Required**: Search YouTube directly without setting up Google Cloud projects or billing.
|
|
29
|
+
- **Zero External Dependencies**: Built entirely using Python's standard library (`urllib`, `re`). No `requests`, `selenium`, or `beautifulsoup` needed.
|
|
30
|
+
- **Advanced Filtering**: Built-in support for duration (Medium 3-20m, Long >20m) and upload date filters (Today, Week, Month, Year).
|
|
31
|
+
- **Rich Data Extraction**: Robustly extracts Video ID, Title, Duration, and View Count.
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
You can install the package via pip:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pip install py-youtube-search
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Quick Start
|
|
42
|
+
|
|
43
|
+
### 1. Basic Search
|
|
44
|
+
Fetch the top results for any keyword.
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
from py_youtube_search import YouTubeSearch
|
|
48
|
+
|
|
49
|
+
# Search for the top 5 results for "Python tutorials"
|
|
50
|
+
search = YouTubeSearch("Python tutorials", limit=5)
|
|
51
|
+
videos = search.videos()
|
|
52
|
+
|
|
53
|
+
for v in videos:
|
|
54
|
+
print(f"Title: {v['title']}")
|
|
55
|
+
print(f"Duration: {v['duration']}")
|
|
56
|
+
print(f"Views: {v['views']}")
|
|
57
|
+
print(f"Link: https://www.youtube.com/watch?v={v['id']}\n")
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### 2. Advanced Search with Filters
|
|
61
|
+
Search for specific types of content, such as long-form tutorials uploaded this week.
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
from py_youtube_search import YouTubeSearch, Filters
|
|
65
|
+
|
|
66
|
+
# Search for "LangGraph" videos over 20 minutes long, uploaded this week
|
|
67
|
+
# Use the Filters class to access constants
|
|
68
|
+
search = YouTubeSearch("LangGraph", sp=Filters.long_this_week, limit=3)
|
|
69
|
+
videos = search.videos()
|
|
70
|
+
|
|
71
|
+
for v in videos:
|
|
72
|
+
print(f"🎥 {v['title']} | ⏱ {v['duration']} | 👁 {v['views']}")
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Available Filters
|
|
76
|
+
|
|
77
|
+
You can access these filters using the `Filters` class (e.g., `Filters.long_today`).
|
|
78
|
+
|
|
79
|
+
### Duration: Medium (3 - 20 Minutes)
|
|
80
|
+
| Filter Attribute | Description |
|
|
81
|
+
| :--- | :--- |
|
|
82
|
+
| `Filters.medium_today` | Uploaded **Today** |
|
|
83
|
+
| `Filters.medium_this_week` | Uploaded **This Week** |
|
|
84
|
+
| `Filters.medium_this_month` | Uploaded **This Month** |
|
|
85
|
+
| `Filters.medium_this_year` | Uploaded **This Year** |
|
|
86
|
+
|
|
87
|
+
### Duration: Long (Over 20 Minutes)
|
|
88
|
+
| Filter Attribute | Description |
|
|
89
|
+
| :--- | :--- |
|
|
90
|
+
| `Filters.long_today` | Uploaded **Today** |
|
|
91
|
+
| `Filters.long_this_week` | Uploaded **This Week** |
|
|
92
|
+
| `Filters.long_this_month` | Uploaded **This Month** |
|
|
93
|
+
| `Filters.long_this_year` | Uploaded **This Year** |
|
|
94
|
+
|
|
95
|
+
## Data Structure
|
|
96
|
+
|
|
97
|
+
The `videos()` method returns a list of dictionaries with the following structure:
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
[
|
|
101
|
+
{
|
|
102
|
+
"id": "lDoYisPfcck",
|
|
103
|
+
"title": "Hack the planet! LangGraph AI HackBot Dev & Q/A",
|
|
104
|
+
"duration": "1:05:23",
|
|
105
|
+
"views": "1.2K views",
|
|
106
|
+
"url_suffix": "/watch?v=lDoYisPfcck"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"id": "5LXLmUsEM20",
|
|
110
|
+
"title": "LangGraph Workflow Patterns - Part 1/10",
|
|
111
|
+
"duration": "42 seconds",
|
|
112
|
+
"views": "500 views",
|
|
113
|
+
"url_suffix": "/watch?v=5LXLmUsEM20"
|
|
114
|
+
}
|
|
115
|
+
]
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## License
|
|
119
|
+
|
|
120
|
+
This project is licensed under the MIT License - see below for details.
|
|
121
|
+
|
|
122
|
+
```text
|
|
123
|
+
MIT License
|
|
124
|
+
|
|
125
|
+
Copyright (c) 2026
|
|
126
|
+
|
|
127
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
128
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
129
|
+
in the Software without restriction, including without limitation the rights
|
|
130
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
131
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
132
|
+
furnished to do so, subject to the following conditions:
|
|
133
|
+
|
|
134
|
+
The above copyright notice and this permission notice shall be included in all
|
|
135
|
+
copies or substantial portions of the Software.
|
|
136
|
+
|
|
137
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
138
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
139
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
140
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
141
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
142
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
143
|
+
SOFTWARE.
|
|
144
|
+
```
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# py-youtube-search
|
|
2
|
+
|
|
3
|
+
A lightweight, zero-dependency Python library to search YouTube videos programmatically without an API key. This library uses standard Python libraries (`urllib` and `re`) to scrape search results, making it fast, robust, and easy to integrate into any project.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **No API Key Required**: Search YouTube directly without setting up Google Cloud projects or billing.
|
|
8
|
+
- **Zero External Dependencies**: Built entirely using Python's standard library (`urllib`, `re`). No `requests`, `selenium`, or `beautifulsoup` needed.
|
|
9
|
+
- **Advanced Filtering**: Built-in support for duration (Medium 3-20m, Long >20m) and upload date filters (Today, Week, Month, Year).
|
|
10
|
+
- **Rich Data Extraction**: Robustly extracts Video ID, Title, Duration, and View Count.
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
You can install the package via pip:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pip install py-youtube-search
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Quick Start
|
|
21
|
+
|
|
22
|
+
### 1. Basic Search
|
|
23
|
+
Fetch the top results for any keyword.
|
|
24
|
+
|
|
25
|
+
```python
|
|
26
|
+
from py_youtube_search import YouTubeSearch
|
|
27
|
+
|
|
28
|
+
# Search for the top 5 results for "Python tutorials"
|
|
29
|
+
search = YouTubeSearch("Python tutorials", limit=5)
|
|
30
|
+
videos = search.videos()
|
|
31
|
+
|
|
32
|
+
for v in videos:
|
|
33
|
+
print(f"Title: {v['title']}")
|
|
34
|
+
print(f"Duration: {v['duration']}")
|
|
35
|
+
print(f"Views: {v['views']}")
|
|
36
|
+
print(f"Link: https://www.youtube.com/watch?v={v['id']}\n")
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 2. Advanced Search with Filters
|
|
40
|
+
Search for specific types of content, such as long-form tutorials uploaded this week.
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
from py_youtube_search import YouTubeSearch, Filters
|
|
44
|
+
|
|
45
|
+
# Search for "LangGraph" videos over 20 minutes long, uploaded this week
|
|
46
|
+
# Use the Filters class to access constants
|
|
47
|
+
search = YouTubeSearch("LangGraph", sp=Filters.long_this_week, limit=3)
|
|
48
|
+
videos = search.videos()
|
|
49
|
+
|
|
50
|
+
for v in videos:
|
|
51
|
+
print(f"🎥 {v['title']} | ⏱ {v['duration']} | 👁 {v['views']}")
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Available Filters
|
|
55
|
+
|
|
56
|
+
You can access these filters using the `Filters` class (e.g., `Filters.long_today`).
|
|
57
|
+
|
|
58
|
+
### Duration: Medium (3 - 20 Minutes)
|
|
59
|
+
| Filter Attribute | Description |
|
|
60
|
+
| :--- | :--- |
|
|
61
|
+
| `Filters.medium_today` | Uploaded **Today** |
|
|
62
|
+
| `Filters.medium_this_week` | Uploaded **This Week** |
|
|
63
|
+
| `Filters.medium_this_month` | Uploaded **This Month** |
|
|
64
|
+
| `Filters.medium_this_year` | Uploaded **This Year** |
|
|
65
|
+
|
|
66
|
+
### Duration: Long (Over 20 Minutes)
|
|
67
|
+
| Filter Attribute | Description |
|
|
68
|
+
| :--- | :--- |
|
|
69
|
+
| `Filters.long_today` | Uploaded **Today** |
|
|
70
|
+
| `Filters.long_this_week` | Uploaded **This Week** |
|
|
71
|
+
| `Filters.long_this_month` | Uploaded **This Month** |
|
|
72
|
+
| `Filters.long_this_year` | Uploaded **This Year** |
|
|
73
|
+
|
|
74
|
+
## Data Structure
|
|
75
|
+
|
|
76
|
+
The `videos()` method returns a list of dictionaries with the following structure:
|
|
77
|
+
|
|
78
|
+
```json
|
|
79
|
+
[
|
|
80
|
+
{
|
|
81
|
+
"id": "lDoYisPfcck",
|
|
82
|
+
"title": "Hack the planet! LangGraph AI HackBot Dev & Q/A",
|
|
83
|
+
"duration": "1:05:23",
|
|
84
|
+
"views": "1.2K views",
|
|
85
|
+
"url_suffix": "/watch?v=lDoYisPfcck"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"id": "5LXLmUsEM20",
|
|
89
|
+
"title": "LangGraph Workflow Patterns - Part 1/10",
|
|
90
|
+
"duration": "42 seconds",
|
|
91
|
+
"views": "500 views",
|
|
92
|
+
"url_suffix": "/watch?v=5LXLmUsEM20"
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## License
|
|
98
|
+
|
|
99
|
+
This project is licensed under the MIT License - see below for details.
|
|
100
|
+
|
|
101
|
+
```text
|
|
102
|
+
MIT License
|
|
103
|
+
|
|
104
|
+
Copyright (c) 2026
|
|
105
|
+
|
|
106
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
107
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
108
|
+
in the Software without restriction, including without limitation the rights
|
|
109
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
110
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
111
|
+
furnished to do so, subject to the following conditions:
|
|
112
|
+
|
|
113
|
+
The above copyright notice and this permission notice shall be included in all
|
|
114
|
+
copies or substantial portions of the Software.
|
|
115
|
+
|
|
116
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
117
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
118
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
119
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
120
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
121
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
122
|
+
SOFTWARE.
|
|
123
|
+
```
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import re
|
|
2
|
+
import urllib.request
|
|
3
|
+
|
|
4
|
+
# Filter constants accessible to the user
|
|
5
|
+
class Filters:
|
|
6
|
+
# Duration: 3 - 20 Minutes (Medium)
|
|
7
|
+
medium_today = "EgYIAhABGAU="
|
|
8
|
+
medium_this_week = "EgQIAxGF"
|
|
9
|
+
medium_this_month = "EgYIBBABGAU="
|
|
10
|
+
medium_this_year = "EgYIBRABGAU="
|
|
11
|
+
|
|
12
|
+
# Duration: Over 20 Minutes (Long)
|
|
13
|
+
long_today = "EgYIAhABGAI="
|
|
14
|
+
long_this_week = "EgQIAxAB"
|
|
15
|
+
long_this_month = "EgYIBBABGAI="
|
|
16
|
+
long_this_year = "EgYIBRABGAI="
|
|
17
|
+
|
|
18
|
+
class YouTubeSearch:
|
|
19
|
+
def __init__(self, keywords: str, sp: str = None, limit: int = 15):
|
|
20
|
+
self.keywords = keywords.replace(" ", "+")
|
|
21
|
+
self.sp = sp
|
|
22
|
+
self.limit = limit
|
|
23
|
+
self.source = self._fetch_source()
|
|
24
|
+
|
|
25
|
+
def _fetch_source(self):
|
|
26
|
+
base_url = f"https://www.youtube.com/results?search_query={self.keywords}"
|
|
27
|
+
if self.sp:
|
|
28
|
+
url = f"{base_url}&sp={self.sp}"
|
|
29
|
+
else:
|
|
30
|
+
url = base_url
|
|
31
|
+
|
|
32
|
+
headers = {
|
|
33
|
+
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36"
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
req = urllib.request.Request(url, headers=headers)
|
|
37
|
+
with urllib.request.urlopen(req) as response:
|
|
38
|
+
return response.read().decode("utf-8")
|
|
39
|
+
|
|
40
|
+
def videos(self):
|
|
41
|
+
# Regex to capture distinct JSON fields for ID, Title, Duration, and Views.
|
|
42
|
+
pattern = (
|
|
43
|
+
r'\"videoRenderer\":\{'
|
|
44
|
+
r'.+?\"videoId\":\"(?P<id>\S{11})\"'
|
|
45
|
+
r'.+?\"title\":\{\"runs\":\[\{\"text\":\"(?P<title>.+?)\"\}\]'
|
|
46
|
+
r'.+?\"lengthText\":\{.*?\"simpleText\":\"(?P<duration>.+?)\"\}'
|
|
47
|
+
r'.+?\"viewCountText\":\{\"simpleText\":\"(?P<views>.+?)\"\}'
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
matches = re.finditer(pattern, self.source)
|
|
51
|
+
|
|
52
|
+
results = []
|
|
53
|
+
for match in matches:
|
|
54
|
+
if len(results) >= self.limit:
|
|
55
|
+
break
|
|
56
|
+
|
|
57
|
+
data = match.groupdict()
|
|
58
|
+
results.append({
|
|
59
|
+
"id": data["id"],
|
|
60
|
+
"title": data["title"],
|
|
61
|
+
"duration": data["duration"],
|
|
62
|
+
"views": data["views"],
|
|
63
|
+
"url_suffix": f"/watch?v={data['id']}"
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
return results
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: py-youtube-search
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A lightweight, regex-based YouTube search library without API keys.
|
|
5
|
+
Home-page: https://github.com/yourusername/py-youtube-search
|
|
6
|
+
Author: Your Name
|
|
7
|
+
Author-email: your.email@example.com
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.6
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
Dynamic: author
|
|
14
|
+
Dynamic: author-email
|
|
15
|
+
Dynamic: classifier
|
|
16
|
+
Dynamic: description
|
|
17
|
+
Dynamic: description-content-type
|
|
18
|
+
Dynamic: home-page
|
|
19
|
+
Dynamic: requires-python
|
|
20
|
+
Dynamic: summary
|
|
21
|
+
|
|
22
|
+
# py-youtube-search
|
|
23
|
+
|
|
24
|
+
A lightweight, zero-dependency Python library to search YouTube videos programmatically without an API key. This library uses standard Python libraries (`urllib` and `re`) to scrape search results, making it fast, robust, and easy to integrate into any project.
|
|
25
|
+
|
|
26
|
+
## Features
|
|
27
|
+
|
|
28
|
+
- **No API Key Required**: Search YouTube directly without setting up Google Cloud projects or billing.
|
|
29
|
+
- **Zero External Dependencies**: Built entirely using Python's standard library (`urllib`, `re`). No `requests`, `selenium`, or `beautifulsoup` needed.
|
|
30
|
+
- **Advanced Filtering**: Built-in support for duration (Medium 3-20m, Long >20m) and upload date filters (Today, Week, Month, Year).
|
|
31
|
+
- **Rich Data Extraction**: Robustly extracts Video ID, Title, Duration, and View Count.
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
You can install the package via pip:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pip install py-youtube-search
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Quick Start
|
|
42
|
+
|
|
43
|
+
### 1. Basic Search
|
|
44
|
+
Fetch the top results for any keyword.
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
from py_youtube_search import YouTubeSearch
|
|
48
|
+
|
|
49
|
+
# Search for the top 5 results for "Python tutorials"
|
|
50
|
+
search = YouTubeSearch("Python tutorials", limit=5)
|
|
51
|
+
videos = search.videos()
|
|
52
|
+
|
|
53
|
+
for v in videos:
|
|
54
|
+
print(f"Title: {v['title']}")
|
|
55
|
+
print(f"Duration: {v['duration']}")
|
|
56
|
+
print(f"Views: {v['views']}")
|
|
57
|
+
print(f"Link: https://www.youtube.com/watch?v={v['id']}\n")
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### 2. Advanced Search with Filters
|
|
61
|
+
Search for specific types of content, such as long-form tutorials uploaded this week.
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
from py_youtube_search import YouTubeSearch, Filters
|
|
65
|
+
|
|
66
|
+
# Search for "LangGraph" videos over 20 minutes long, uploaded this week
|
|
67
|
+
# Use the Filters class to access constants
|
|
68
|
+
search = YouTubeSearch("LangGraph", sp=Filters.long_this_week, limit=3)
|
|
69
|
+
videos = search.videos()
|
|
70
|
+
|
|
71
|
+
for v in videos:
|
|
72
|
+
print(f"🎥 {v['title']} | ⏱ {v['duration']} | 👁 {v['views']}")
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Available Filters
|
|
76
|
+
|
|
77
|
+
You can access these filters using the `Filters` class (e.g., `Filters.long_today`).
|
|
78
|
+
|
|
79
|
+
### Duration: Medium (3 - 20 Minutes)
|
|
80
|
+
| Filter Attribute | Description |
|
|
81
|
+
| :--- | :--- |
|
|
82
|
+
| `Filters.medium_today` | Uploaded **Today** |
|
|
83
|
+
| `Filters.medium_this_week` | Uploaded **This Week** |
|
|
84
|
+
| `Filters.medium_this_month` | Uploaded **This Month** |
|
|
85
|
+
| `Filters.medium_this_year` | Uploaded **This Year** |
|
|
86
|
+
|
|
87
|
+
### Duration: Long (Over 20 Minutes)
|
|
88
|
+
| Filter Attribute | Description |
|
|
89
|
+
| :--- | :--- |
|
|
90
|
+
| `Filters.long_today` | Uploaded **Today** |
|
|
91
|
+
| `Filters.long_this_week` | Uploaded **This Week** |
|
|
92
|
+
| `Filters.long_this_month` | Uploaded **This Month** |
|
|
93
|
+
| `Filters.long_this_year` | Uploaded **This Year** |
|
|
94
|
+
|
|
95
|
+
## Data Structure
|
|
96
|
+
|
|
97
|
+
The `videos()` method returns a list of dictionaries with the following structure:
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
[
|
|
101
|
+
{
|
|
102
|
+
"id": "lDoYisPfcck",
|
|
103
|
+
"title": "Hack the planet! LangGraph AI HackBot Dev & Q/A",
|
|
104
|
+
"duration": "1:05:23",
|
|
105
|
+
"views": "1.2K views",
|
|
106
|
+
"url_suffix": "/watch?v=lDoYisPfcck"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"id": "5LXLmUsEM20",
|
|
110
|
+
"title": "LangGraph Workflow Patterns - Part 1/10",
|
|
111
|
+
"duration": "42 seconds",
|
|
112
|
+
"views": "500 views",
|
|
113
|
+
"url_suffix": "/watch?v=5LXLmUsEM20"
|
|
114
|
+
}
|
|
115
|
+
]
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## License
|
|
119
|
+
|
|
120
|
+
This project is licensed under the MIT License - see below for details.
|
|
121
|
+
|
|
122
|
+
```text
|
|
123
|
+
MIT License
|
|
124
|
+
|
|
125
|
+
Copyright (c) 2026
|
|
126
|
+
|
|
127
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
128
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
129
|
+
in the Software without restriction, including without limitation the rights
|
|
130
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
131
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
132
|
+
furnished to do so, subject to the following conditions:
|
|
133
|
+
|
|
134
|
+
The above copyright notice and this permission notice shall be included in all
|
|
135
|
+
copies or substantial portions of the Software.
|
|
136
|
+
|
|
137
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
138
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
139
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
140
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
141
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
142
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
143
|
+
SOFTWARE.
|
|
144
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
py_youtube_search
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
with open("README.md", "r", encoding="utf-8") as fh:
|
|
4
|
+
long_description = fh.read()
|
|
5
|
+
|
|
6
|
+
setup(
|
|
7
|
+
name="py-youtube-search",
|
|
8
|
+
version="0.1.0",
|
|
9
|
+
author="Your Name", # <--- Change this
|
|
10
|
+
author_email="your.email@example.com", # <--- Change this
|
|
11
|
+
description="A lightweight, regex-based YouTube search library without API keys.",
|
|
12
|
+
long_description=long_description,
|
|
13
|
+
long_description_content_type="text/markdown",
|
|
14
|
+
url="https://github.com/yourusername/py-youtube-search", # <--- Change this
|
|
15
|
+
packages=find_packages(),
|
|
16
|
+
classifiers=[
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"License :: OSI Approved :: MIT License",
|
|
19
|
+
"Operating System :: OS Independent",
|
|
20
|
+
],
|
|
21
|
+
python_requires='>=3.6',
|
|
22
|
+
)
|