warp-beacon 2.2.17__tar.gz → 2.2.19__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.
- {warp_beacon-2.2.17/warp_beacon.egg-info → warp_beacon-2.2.19}/PKG-INFO +1 -1
- warp_beacon-2.2.19/warp_beacon/__version__.py +2 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/warp_beacon/scraper/instagram/instagram.py +4 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/warp_beacon/scraper/youtube/abstract.py +23 -29
- {warp_beacon-2.2.17 → warp_beacon-2.2.19/warp_beacon.egg-info}/PKG-INFO +1 -1
- warp_beacon-2.2.17/warp_beacon/__version__.py +0 -2
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/LICENSE +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/MANIFEST.in +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/README.md +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/assets/placeholder.gif +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/etc/.gitignore +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/etc/accounts.json +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/etc/warp_beacon.conf +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/etc/warp_beacon.service +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/pyproject.toml +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/setup.cfg +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/setup.py +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/warp_beacon/__init__.py +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/warp_beacon/compress/__init__.py +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/warp_beacon/compress/video.py +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/warp_beacon/jobs/__init__.py +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/warp_beacon/jobs/abstract.py +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/warp_beacon/jobs/download_job.py +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/warp_beacon/jobs/types.py +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/warp_beacon/jobs/upload_job.py +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/warp_beacon/mediainfo/__init__.py +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/warp_beacon/mediainfo/abstract.py +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/warp_beacon/mediainfo/audio.py +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/warp_beacon/mediainfo/silencer.py +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/warp_beacon/mediainfo/video.py +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/warp_beacon/scheduler/__init__.py +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/warp_beacon/scheduler/scheduler.py +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/warp_beacon/scraper/__init__.py +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/warp_beacon/scraper/abstract.py +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/warp_beacon/scraper/account_selector.py +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/warp_beacon/scraper/exceptions.py +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/warp_beacon/scraper/instagram/__init__.py +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/warp_beacon/scraper/youtube/__init__.py +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/warp_beacon/scraper/youtube/music.py +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/warp_beacon/scraper/youtube/shorts.py +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/warp_beacon/scraper/youtube/youtube.py +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/warp_beacon/storage/__init__.py +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/warp_beacon/telegram/__init__.py +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/warp_beacon/telegram/bot.py +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/warp_beacon/telegram/handlers.py +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/warp_beacon/telegram/placeholder_message.py +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/warp_beacon/telegram/utils.py +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/warp_beacon/uploader/__init__.py +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/warp_beacon/warp_beacon.py +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/warp_beacon.egg-info/SOURCES.txt +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/warp_beacon.egg-info/dependency_links.txt +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/warp_beacon.egg-info/entry_points.txt +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/warp_beacon.egg-info/requires.txt +0 -0
- {warp_beacon-2.2.17 → warp_beacon-2.2.19}/warp_beacon.egg-info/top_level.txt +0 -0
@@ -89,6 +89,7 @@ class InstagramScraper(ScraperAbstract):
|
|
89
89
|
self.load_session()
|
90
90
|
self._download_hndlr(self.cl.get_timeline_feed)
|
91
91
|
self._download_hndlr(self.cl.get_reels_tray_feed)
|
92
|
+
self.safe_write_session()
|
92
93
|
|
93
94
|
def scrap(self, url: str) -> tuple[str]:
|
94
95
|
self.load_session()
|
@@ -283,6 +284,9 @@ class InstagramScraper(ScraperAbstract):
|
|
283
284
|
raise NotFound(extract_exception_message(e))
|
284
285
|
except IGUnknownError as e:
|
285
286
|
raise UnknownError(extract_exception_message(e))
|
287
|
+
|
288
|
+
self.safe_write_session()
|
289
|
+
|
286
290
|
return res
|
287
291
|
|
288
292
|
def email_challenge_resolver(self, username: str) -> Optional[str]:
|
@@ -103,30 +103,28 @@ class YoutubeAbstract(ScraperAbstract):
|
|
103
103
|
if "yt_download_" in i:
|
104
104
|
os.unlink("%s/%s" % (self.DOWNLOAD_DIR, i))
|
105
105
|
|
106
|
-
def
|
107
|
-
# check ratio
|
106
|
+
def calculate_size_with_padding(self, image: Image, aspect_ratio_width: int, aspect_ratio_height: int, target_size: tuple=(320, 320), background_color: tuple=(0, 0, 0)) -> Image:
|
108
107
|
aspect_ratio = aspect_ratio_width / aspect_ratio_height
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
if height < min_height:
|
117
|
-
height = min_height
|
118
|
-
width = int(height * aspect_ratio)
|
119
|
-
else:
|
120
|
-
# Probing max width and calculating height
|
121
|
-
width = max_width
|
108
|
+
target_width, target_height = target_size
|
109
|
+
|
110
|
+
height = target_height
|
111
|
+
width = int(height * aspect_ratio)
|
112
|
+
|
113
|
+
if width > target_width:
|
114
|
+
width = target_width
|
122
115
|
height = int(width / aspect_ratio)
|
123
|
-
|
124
|
-
# if height exceeds max height Telegram, recalculatng based on max height
|
125
|
-
if height > max_height:
|
126
|
-
height = max_height
|
127
|
-
width = int(height * aspect_ratio)
|
128
116
|
|
129
|
-
|
117
|
+
new_image = Image.new("RGB", target_size, background_color)
|
118
|
+
image.thumbnail(target_size, Image.Resampling.LANCZOS)
|
119
|
+
|
120
|
+
if aspect_ratio_height > 4:
|
121
|
+
image = image.resize((image.size[0], image.size[1]+new_image.size[1]))
|
122
|
+
height += new_image.size[1] - 20
|
123
|
+
|
124
|
+
paste_position = ((target_width - width) // 2, (target_height - height) // 2)
|
125
|
+
new_image.paste(image, paste_position)
|
126
|
+
|
127
|
+
return new_image
|
130
128
|
|
131
129
|
def aspect_ratio(self, size: tuple) -> tuple:
|
132
130
|
gcd = math.gcd(size[0], size[1])
|
@@ -143,16 +141,12 @@ class YoutubeAbstract(ScraperAbstract):
|
|
143
141
|
if response.status_code == 200:
|
144
142
|
image = Image.open(io.BytesIO(response.content))
|
145
143
|
ratio = self.aspect_ratio(image.size)
|
146
|
-
|
147
|
-
new_image =
|
148
|
-
|
149
|
-
image_position = (
|
150
|
-
(desired_size[0] - image.size[0]) // 2,
|
151
|
-
(desired_size[1] - image.size[1]) // 2
|
152
|
-
)
|
153
|
-
new_image.paste(image, image_position)
|
144
|
+
logging.info("thumb ratio: '%s'", ratio)
|
145
|
+
new_image = self.calculate_size_with_padding(image, ratio[0], ratio[1])
|
146
|
+
logging.info("thumb size: '%s'", new_image.size)
|
154
147
|
io_buf = io.BytesIO()
|
155
148
|
new_image.save(io_buf, format='JPEG', subsampling=0, quality=100, progressive=True, optimize=False)
|
149
|
+
logging.info("thumb size: %d kb", io_buf.getbuffer().nbytes / 1024)
|
156
150
|
io_buf.seek(0)
|
157
151
|
return io_buf
|
158
152
|
except Exception as e:
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|