warp-beacon 2.6.53__tar.gz → 2.6.55__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.6.53/warp_beacon.egg-info → warp_beacon-2.6.55}/PKG-INFO +1 -1
- warp_beacon-2.6.55/warp_beacon/__version__.py +2 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/scraper/abstract.py +10 -10
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/scraper/instagram/instagram.py +3 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/scraper/youtube/abstract.py +2 -4
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/telegram/progress_bar.py +39 -17
- {warp_beacon-2.6.53 → warp_beacon-2.6.55/warp_beacon.egg-info}/PKG-INFO +1 -1
- warp_beacon-2.6.53/warp_beacon/__version__.py +0 -2
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/LICENSE +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/MANIFEST.in +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/README.md +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/assets/placeholder.gif +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/etc/.gitignore +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/etc/accounts.json +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/etc/proxies.json +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/etc/warp_beacon.conf +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/etc/warp_beacon.service +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/pyproject.toml +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/setup.cfg +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/setup.py +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/__init__.py +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/compress/__init__.py +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/compress/video.py +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/jobs/__init__.py +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/jobs/abstract.py +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/jobs/download_job.py +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/jobs/types.py +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/jobs/upload_job.py +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/mediainfo/__init__.py +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/mediainfo/abstract.py +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/mediainfo/audio.py +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/mediainfo/silencer.py +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/mediainfo/video.py +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/scheduler/__init__.py +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/scheduler/instagram_human.py +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/scheduler/scheduler.py +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/scraper/__init__.py +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/scraper/account_selector.py +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/scraper/exceptions.py +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/scraper/fail_handler.py +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/scraper/instagram/__init__.py +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/scraper/instagram/captcha.py +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/scraper/link_resolver.py +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/scraper/utils.py +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/scraper/youtube/__init__.py +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/scraper/youtube/music.py +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/scraper/youtube/shorts.py +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/scraper/youtube/youtube.py +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/storage/__init__.py +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/storage/mongo.py +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/telegram/__init__.py +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/telegram/bot.py +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/telegram/caption_shortener.py +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/telegram/download_status.py +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/telegram/edit_message.py +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/telegram/handlers.py +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/telegram/placeholder_message.py +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/telegram/progress_file_reader.py +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/telegram/utils.py +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/uploader/__init__.py +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/warp_beacon.py +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon/yt_auth.py +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon.egg-info/SOURCES.txt +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon.egg-info/dependency_links.txt +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon.egg-info/entry_points.txt +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon.egg-info/requires.txt +0 -0
- {warp_beacon-2.6.53 → warp_beacon-2.6.55}/warp_beacon.egg-info/top_level.txt +0 -0
@@ -12,16 +12,16 @@ from PIL import Image
|
|
12
12
|
from pillow_heif import register_heif_opener
|
13
13
|
|
14
14
|
class ScraperAbstract(ABC):
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
15
|
+
def __init__(self, account: tuple, proxy: dict = None) -> None:
|
16
|
+
self.original_gai_family = None
|
17
|
+
self.send_message_to_admin_func: Callable = lambda: None
|
18
|
+
self.request_yt_auth: Callable = lambda: None
|
19
|
+
self.status_pipe: multiprocessing.connection.Connection = None
|
20
|
+
self.auth_event = None
|
21
|
+
self.account = None
|
22
|
+
self.account_index = 0
|
23
|
+
self.proxy = None
|
24
|
+
self.job = None
|
25
25
|
self._gai_lock = multiprocessing.Lock()
|
26
26
|
self.account_index = account[0]
|
27
27
|
self.account = account[1]
|
@@ -304,10 +304,13 @@ class InstagramScraper(ScraperAbstract):
|
|
304
304
|
|
305
305
|
def download(self, job: DownloadJob) -> Optional[list[dict]]:
|
306
306
|
res = []
|
307
|
+
self.job = job
|
307
308
|
while True:
|
308
309
|
try:
|
309
310
|
scrap_type, media_id = self.scrap(job.url)
|
310
311
|
if scrap_type == "media":
|
312
|
+
#self.status_pipe.send({"action": "report_download_status", "current": 0, "total": 0,
|
313
|
+
# "message_id": self.job.placeholder_message_id, "chat_id": self.job.chat_id, "label": "Collection meta information ..."})
|
311
314
|
media_info = self.download_hndlr(self.cl.media_info, media_id, use_cache=False)
|
312
315
|
logging.info("media_type is '%d', product_type is '%s'", media_info.media_type, media_info.product_type)
|
313
316
|
if media_info.media_type == 2 and media_info.product_type == "clips": # Reels
|
@@ -35,8 +35,6 @@ class YoutubeAbstract(ScraperAbstract):
|
|
35
35
|
DOWNLOAD_DIR = "/tmp"
|
36
36
|
YT_SESSION_FILE = '/var/warp_beacon/yt_session_%d.json'
|
37
37
|
|
38
|
-
job = None
|
39
|
-
|
40
38
|
def __init__(self, account: tuple, proxy: dict=None) -> None:
|
41
39
|
super().__init__(account, proxy)
|
42
40
|
self._download_progress_threshold = 20
|
@@ -321,10 +319,10 @@ class YoutubeAbstract(ScraperAbstract):
|
|
321
319
|
|
322
320
|
return yt_dlp.YoutubeDL(ydl_opts)
|
323
321
|
|
324
|
-
def _download(self,
|
322
|
+
def _download(self, url: str, session: bool = True, thumbnail: Optional[io.BytesIO] = None, timeout: int = 60) -> list:
|
325
323
|
raise NotImplementedError("You should to implement _download method")
|
326
324
|
|
327
|
-
def _download_yt_dlp(self,
|
325
|
+
def _download_yt_dlp(self, url: str, thumbnail: Optional[io.BytesIO] = None, timeout: int = 60) -> list:
|
328
326
|
raise NotImplementedError("You should to implement _download_yt_dlp method")
|
329
327
|
|
330
328
|
def download(self, job: DownloadJob) -> list:
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import logging
|
2
2
|
|
3
|
+
import asyncio
|
3
4
|
import hashlib
|
4
5
|
|
5
6
|
from pyrogram.enums import ParseMode
|
@@ -34,31 +35,52 @@ class ProgressBar(object):
|
|
34
35
|
percent = frac * 100
|
35
36
|
return f"<b>[{pbar}] {round(percent)}%</b>"
|
36
37
|
|
37
|
-
def make_emoji_progress_bar(self,
|
38
|
+
def make_emoji_progress_bar(self, percent: int, length: int = 10) -> str:
|
38
39
|
"""
|
39
|
-
|
40
|
-
|
41
|
-
|
40
|
+
Builds an emoji progress bar.
|
41
|
+
|
42
|
+
Args:
|
43
|
+
percent: int from 0 to 100
|
44
|
+
length: total number of emoji cells
|
45
|
+
|
46
|
+
Returns:
|
47
|
+
String like "[🟩🟩🟩⬜️⬜️⬜️⬜️⬜️⬜️⬜️] 30%"
|
42
48
|
"""
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
+
filled = int(percent * length / 100 + 0.5)
|
50
|
+
empty = length - filled
|
51
|
+
bar = "🟩" * filled + "⬜️" * empty
|
52
|
+
return f"[{bar}] {percent}%"
|
53
|
+
|
54
|
+
def _on_edit_done(self, task: asyncio.Task) -> None:
|
55
|
+
exc = task.exception()
|
56
|
+
if not exc:
|
57
|
+
return
|
58
|
+
if isinstance(exc, MessageNotModified):
|
59
|
+
logging.warning("bad_request_400.MessageNotModified")
|
60
|
+
else:
|
61
|
+
logging.exception("Error in edit_message_caption", exc_info=exc)
|
49
62
|
|
50
63
|
async def progress_callback(self, current: int, total: int, chat_id: int | str, message_id: int, operation: str, label: str = "") -> None:
|
51
|
-
|
64
|
+
if self.complete:
|
65
|
+
return
|
66
|
+
percent = 0
|
67
|
+
if total:
|
68
|
+
percent = round(current * 100 / (total or 1))
|
52
69
|
if total == 0 or percent >= self._next_threshold:
|
53
70
|
#pbar = self.make_progress_bar(percent, 100, 25)
|
54
|
-
pbar = self.make_emoji_progress_bar(percent,
|
55
|
-
logging.info("[%s]
|
71
|
+
pbar = self.make_emoji_progress_bar(percent, 14)
|
72
|
+
logging.info("[%s] Operation: %s %d%%", label or operation, operation, round(percent))
|
56
73
|
try:
|
57
|
-
await self.client.edit_message_caption(chat_id, message_id, f"{pbar} <b>{operation}</b> {label}", ParseMode.HTML)
|
58
|
-
|
59
|
-
|
74
|
+
#await self.client.edit_message_caption(chat_id, message_id, f"{pbar} <b>{operation}</b> {label}", ParseMode.HTML)
|
75
|
+
# we don't need to wait completion, waste of time and resources
|
76
|
+
task = self.client.loop.create_task(
|
77
|
+
self.client.edit_message_caption(chat_id, message_id, f"{pbar} <b>{operation}</b> {label}", ParseMode.HTML)
|
78
|
+
)
|
79
|
+
task.add_done_callback(self._on_edit_done)
|
80
|
+
#except MessageNotModified:
|
81
|
+
#logging.warning("bad_request_400.MessageNotModified")
|
60
82
|
except Exception as e:
|
61
|
-
logging.warning("An error occurred while
|
83
|
+
logging.warning("An error occurred while setup task to update progress bar")
|
62
84
|
logging.exception(e)
|
63
85
|
if total > 0:
|
64
86
|
self._next_threshold += 20
|
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
|
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
|