warp-beacon 2.2.50__py3-none-any.whl → 2.2.52__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.
- warp_beacon/__version__.py +1 -1
- warp_beacon/scraper/youtube/abstract.py +9 -7
- {warp_beacon-2.2.50.dist-info → warp_beacon-2.2.52.dist-info}/METADATA +2 -1
- {warp_beacon-2.2.50.dist-info → warp_beacon-2.2.52.dist-info}/RECORD +8 -8
- {warp_beacon-2.2.50.dist-info → warp_beacon-2.2.52.dist-info}/LICENSE +0 -0
- {warp_beacon-2.2.50.dist-info → warp_beacon-2.2.52.dist-info}/WHEEL +0 -0
- {warp_beacon-2.2.50.dist-info → warp_beacon-2.2.52.dist-info}/entry_points.txt +0 -0
- {warp_beacon-2.2.50.dist-info → warp_beacon-2.2.52.dist-info}/top_level.txt +0 -0
warp_beacon/__version__.py
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
__version__ = "2.2.
|
1
|
+
__version__ = "2.2.52"
|
2
2
|
|
@@ -11,9 +11,10 @@ import urllib
|
|
11
11
|
import requests
|
12
12
|
import http.client
|
13
13
|
from PIL import Image
|
14
|
+
import numpy as np
|
14
15
|
|
15
16
|
from warp_beacon.scraper.abstract import ScraperAbstract
|
16
|
-
from warp_beacon.mediainfo.abstract import MediaInfoAbstract
|
17
|
+
#from warp_beacon.mediainfo.abstract import MediaInfoAbstract
|
17
18
|
from warp_beacon.scraper.exceptions import TimeOut, Unavailable, extract_exception_message
|
18
19
|
|
19
20
|
from pytubefix import YouTube
|
@@ -137,6 +138,10 @@ class YoutubeAbstract(ScraperAbstract):
|
|
137
138
|
def aspect_ratio(self, size: tuple) -> tuple:
|
138
139
|
gcd = math.gcd(size[0], size[1])
|
139
140
|
return size[0] // gcd, size[1] // gcd
|
141
|
+
|
142
|
+
def crop_black_edges_pil(self, img: Image) -> Image:
|
143
|
+
y_nonzero, x_nonzero, _ = np.nonzero(img)
|
144
|
+
return img.crop((np.min(x_nonzero), np.min(y_nonzero), np.max(x_nonzero), np.max(y_nonzero)))
|
140
145
|
|
141
146
|
def download_thumbnail(self, video_id: str, timeout: int) -> Optional[io.BytesIO]:
|
142
147
|
for i in (#"https://img.youtube.com/vi/{VIDEO_ID}/maxresdefault.jpg",
|
@@ -148,16 +153,13 @@ class YoutubeAbstract(ScraperAbstract):
|
|
148
153
|
with requests.get(url, timeout=(timeout, timeout)) as response:
|
149
154
|
if response.status_code == 200:
|
150
155
|
image = Image.open(io.BytesIO(response.content))
|
156
|
+
image = self.crop_black_edges_pil(image)
|
151
157
|
ratio = self.aspect_ratio(image.size)
|
152
158
|
logging.info("thumb ratio: '%s'", ratio)
|
153
|
-
new_image =
|
154
|
-
if ratio[1] > 4:
|
155
|
-
new_image = self.resize_aspect_ratio(image)
|
156
|
-
else:
|
157
|
-
new_image = self.calculate_size_with_padding(image, ratio[0], ratio[1])
|
159
|
+
new_image = self.resize_aspect_ratio(image)
|
158
160
|
logging.info("thumb size: '%s'", new_image.size)
|
159
161
|
io_buf = io.BytesIO()
|
160
|
-
new_image.save(io_buf, format='JPEG', subsampling=0, quality=
|
162
|
+
new_image.save(io_buf, format='JPEG', subsampling=0, quality=95, progressive=True, optimize=False)
|
161
163
|
logging.info("thumb size: %d kb", io_buf.getbuffer().nbytes / 1024)
|
162
164
|
io_buf.seek(0)
|
163
165
|
return io_buf
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: warp_beacon
|
3
|
-
Version: 2.2.
|
3
|
+
Version: 2.2.52
|
4
4
|
Summary: Telegram bot for expanding external media links
|
5
5
|
Home-page: https://github.com/sb0y/warp_beacon
|
6
6
|
Author: Andrey Bagrintsev
|
@@ -224,6 +224,7 @@ Classifier: Programming Language :: Python :: 3.10
|
|
224
224
|
Requires-Python: >=3.10
|
225
225
|
Description-Content-Type: text/markdown
|
226
226
|
License-File: LICENSE
|
227
|
+
Requires-Dist: numpy
|
227
228
|
Requires-Dist: ffmpeg-python
|
228
229
|
Requires-Dist: uvloop
|
229
230
|
Requires-Dist: tgcrypto
|
@@ -3,7 +3,7 @@ lib/systemd/system/warp_beacon.service,sha256=lPmHqLqcI2eIV7nwHS0qcALQrznixqJuww
|
|
3
3
|
var/warp_beacon/accounts.json,sha256=2QQMS9N_Z-TnfZq4U1vSUe4IKyZGmTFdgo8BoF4hQ7E,1710
|
4
4
|
var/warp_beacon/placeholder.gif,sha256=cE5CGJVaop4Sx21zx6j4AyoHU0ncmvQuS2o6hJfEH88,6064
|
5
5
|
warp_beacon/__init__.py,sha256=_rThNODmz0nDp_n4mWo_HKaNFE5jk1_7cRhHyYaencI,163
|
6
|
-
warp_beacon/__version__.py,sha256=
|
6
|
+
warp_beacon/__version__.py,sha256=qkoAXpS3-gHA-Ei5DdDGrmnAmfEcao2FO-2eJikHfGM,24
|
7
7
|
warp_beacon/warp_beacon.py,sha256=7KEtZDj-pdhtl6m-zFLsSojs1ZR4o7L0xbqtdmYPvfE,342
|
8
8
|
warp_beacon/compress/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
9
9
|
warp_beacon/compress/video.py,sha256=_PDMVYCyzLYxHv1uZmmzGcG_8rjaZr7BTXsXTTy_oS4,2846
|
@@ -26,7 +26,7 @@ warp_beacon/scraper/exceptions.py,sha256=fHywTm2-y2RkgM6hVz12CkDMBgHcEoN2a1TBLaV
|
|
26
26
|
warp_beacon/scraper/instagram/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
27
27
|
warp_beacon/scraper/instagram/instagram.py,sha256=m2bAqLu-_HchlF5CVZDlytB9cFGxrN7EEbQW-G1f5u4,12857
|
28
28
|
warp_beacon/scraper/youtube/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
29
|
-
warp_beacon/scraper/youtube/abstract.py,sha256=
|
29
|
+
warp_beacon/scraper/youtube/abstract.py,sha256=cp5Jf2lTV0tZwLcTSZjLTGrhRuROu1wXjIDM4FVeunw,8249
|
30
30
|
warp_beacon/scraper/youtube/music.py,sha256=nbTDFdgXGbTNqttE828DEgvSc8-SuAsQAHeqUwU6yFM,1484
|
31
31
|
warp_beacon/scraper/youtube/shorts.py,sha256=RqMYDq4XHChtp-LdlxXyHej4h3NI3Qi9T8USxwk-pIk,1177
|
32
32
|
warp_beacon/scraper/youtube/youtube.py,sha256=JvN5pVz0jtxCY9FGMl1dIg5Ccr2Kulaoxtym0Vb1QwQ,2224
|
@@ -37,9 +37,9 @@ warp_beacon/telegram/handlers.py,sha256=SyYSDYbHnMpXDqockHTN-8Rg_YimLDfJAOhuubQf
|
|
37
37
|
warp_beacon/telegram/placeholder_message.py,sha256=N1fSL1xbFLF5alhnEvk-xbf3v2A_nLWg6xHtVZTaoiA,6396
|
38
38
|
warp_beacon/telegram/utils.py,sha256=wSyJJsv1chaK4hqnBP-dDiY1hYD7wFhzBzw5H_AwE88,2450
|
39
39
|
warp_beacon/uploader/__init__.py,sha256=rbfsm_eYcfsBRkiaG0glVgBNtQCEe7cVQTWEIAHz5aw,4763
|
40
|
-
warp_beacon-2.2.
|
41
|
-
warp_beacon-2.2.
|
42
|
-
warp_beacon-2.2.
|
43
|
-
warp_beacon-2.2.
|
44
|
-
warp_beacon-2.2.
|
45
|
-
warp_beacon-2.2.
|
40
|
+
warp_beacon-2.2.52.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
41
|
+
warp_beacon-2.2.52.dist-info/METADATA,sha256=jRE68kY2SNf3E7IgvI-HgIOxf3cHn5slHL1eEbNp3iA,21272
|
42
|
+
warp_beacon-2.2.52.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
|
43
|
+
warp_beacon-2.2.52.dist-info/entry_points.txt,sha256=eSB61Rb89d56WY0O-vEIQwkn18J-4CMrJcLA_R_8h3g,119
|
44
|
+
warp_beacon-2.2.52.dist-info/top_level.txt,sha256=ALb_Ft_eG-OY4_m0TWUifNUOZsrx483L-zw7G7vqXoc,971
|
45
|
+
warp_beacon-2.2.52.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|