renderer-pypi 0.0.1__py3-none-any.whl
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.
- renderer_pypi/__init__.py +0 -0
- renderer_pypi/custom_exception.py +6 -0
- renderer_pypi/logger.py +18 -0
- renderer_pypi/youtube.py +29 -0
- renderer_pypi-0.0.1.dist-info/LICENSE +21 -0
- renderer_pypi-0.0.1.dist-info/METADATA +47 -0
- renderer_pypi-0.0.1.dist-info/RECORD +9 -0
- renderer_pypi-0.0.1.dist-info/WHEEL +5 -0
- renderer_pypi-0.0.1.dist-info/top_level.txt +1 -0
|
File without changes
|
renderer_pypi/logger.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import logging
|
|
3
|
+
import sys
|
|
4
|
+
|
|
5
|
+
logging_str = "[%(asctime)s - %(levelname)s: %(module)s]: %(message)s"
|
|
6
|
+
log_dir = "./logs"
|
|
7
|
+
log_filepath = os.path.join(log_dir, "running_logs.log")
|
|
8
|
+
os.makedirs(log_dir, exist_ok=True)
|
|
9
|
+
|
|
10
|
+
logging.basicConfig(
|
|
11
|
+
level=logging.INFO,
|
|
12
|
+
format=logging_str,
|
|
13
|
+
handlers=[
|
|
14
|
+
logging.FileHandler(log_filepath),
|
|
15
|
+
logging.StreamHandler(sys.stdout)
|
|
16
|
+
],
|
|
17
|
+
)
|
|
18
|
+
logger = logging.getLogger("renderer_pypi")
|
renderer_pypi/youtube.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from renderer_pypi.custom_exception import InvalidURLException
|
|
2
|
+
from renderer_pypi.logger import logger
|
|
3
|
+
import re
|
|
4
|
+
from IPython.display import HTML, display
|
|
5
|
+
|
|
6
|
+
def render_youtube_video(url: str, width: int = 780, height: int = 315):
|
|
7
|
+
try:
|
|
8
|
+
# pass
|
|
9
|
+
regex = r"(?:v=|\/)([0-9A-Za-z_-]{11}).*"
|
|
10
|
+
match = re.search(regex, url)
|
|
11
|
+
if not match:
|
|
12
|
+
raise InvalidURLException("The provided YouTube URL is invalid.")
|
|
13
|
+
video_id = match.group(1)
|
|
14
|
+
|
|
15
|
+
embed_url = f"https://www.youtube-nocookie.com/embed/{video_id}"
|
|
16
|
+
|
|
17
|
+
iframe = f"""
|
|
18
|
+
<iframe width="{width}" height="{height}"
|
|
19
|
+
src="{embed_url}" frameborder="0"
|
|
20
|
+
title="YouTube video player"
|
|
21
|
+
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
|
22
|
+
allowfullscreen></iframe>
|
|
23
|
+
"""
|
|
24
|
+
display(HTML(iframe))
|
|
25
|
+
logger.info(f"Successfully rendered YouTube video for URL: {url}")
|
|
26
|
+
return "success"
|
|
27
|
+
|
|
28
|
+
except Exception as e:
|
|
29
|
+
raise e
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Navin Md, Nawshin
|
|
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,47 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: renderer_pypi
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: A simple Python package
|
|
5
|
+
Home-page: https://github.com/navinxqz/Renderer-PyPI-Package
|
|
6
|
+
Author: navinxqz
|
|
7
|
+
Author-email: navinmdnawshin@gmail.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Bug Tracker, https://github.com/navinxqz/Renderer-PyPI-Package/issues
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Requires-Python: >=3.8
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Requires-Dist: ensure==1.0.2
|
|
21
|
+
Requires-Dist: py-youtube==1.1.7
|
|
22
|
+
|
|
23
|
+
# Renderer-PyPI-Package
|
|
24
|
+
|
|
25
|
+
This repo contains the source code for the Renderer package, which is available on PyPI. The Renderer package provides tools and utilities for rendering youtube videos and any web page over the jupyter notebook/colab and visualization in Python applications.
|
|
26
|
+
|
|
27
|
+
# How to run the package
|
|
28
|
+
1. Create a virtual environment:
|
|
29
|
+
```bash
|
|
30
|
+
conda create -n renderer python=3.8 -y
|
|
31
|
+
```
|
|
32
|
+
or to create in a specific path:
|
|
33
|
+
```bash
|
|
34
|
+
conda create -p ./envs/renderer python=3.8 -y
|
|
35
|
+
```
|
|
36
|
+
2. Activate the virtual environment:
|
|
37
|
+
```bash
|
|
38
|
+
conda activate renderer
|
|
39
|
+
```
|
|
40
|
+
or if created in a specific path:
|
|
41
|
+
```bash
|
|
42
|
+
conda activate ./envs/renderer
|
|
43
|
+
```
|
|
44
|
+
3. Install the required packages:
|
|
45
|
+
```bash
|
|
46
|
+
pip install -r requirements_dev.txt
|
|
47
|
+
```
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
renderer_pypi/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
renderer_pypi/custom_exception.py,sha256=KAAB46kJimWx4ZjYYc1AhS_CLURwMTectwtzY0Vbw7M,225
|
|
3
|
+
renderer_pypi/logger.py,sha256=gmCTo4NRcypqcvouP2Qe-MH2a8VpJ3CkqXqBCnQ-4aM,443
|
|
4
|
+
renderer_pypi/youtube.py,sha256=zwlo9AwMzKW4Ee83DVxZEd4EGvLM1t5PHL6sYnz0EwA,1029
|
|
5
|
+
renderer_pypi-0.0.1.dist-info/LICENSE,sha256=J9B9j-wZjcwZf6mAQhdfFZY9lMkWAvDK2uwIpPC9Dgk,1074
|
|
6
|
+
renderer_pypi-0.0.1.dist-info/METADATA,sha256=6x01_V67FXnlFNmQ15-leB-wuY--qiXnCQlNgejUkXM,1583
|
|
7
|
+
renderer_pypi-0.0.1.dist-info/WHEEL,sha256=WnJ8fYhv8N4SYVK2lLYNI6N0kVATA7b0piVUNvqIIJE,91
|
|
8
|
+
renderer_pypi-0.0.1.dist-info/top_level.txt,sha256=241sjk8Uo4LDxE4GVyoAbXYR0meMwXpzZvf8iwCSvIw,14
|
|
9
|
+
renderer_pypi-0.0.1.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
renderer_pypi
|