warp-beacon 2.0.2__py3-none-any.whl → 2.0.4__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/telegram/bot.py +1 -1
- warp_beacon/telegram/handlers.py +7 -2
- warp_beacon/telegram/utils.py +9 -0
- {warp_beacon-2.0.2.dist-info → warp_beacon-2.0.4.dist-info}/METADATA +29 -5
- {warp_beacon-2.0.2.dist-info → warp_beacon-2.0.4.dist-info}/RECORD +10 -10
- {warp_beacon-2.0.2.dist-info → warp_beacon-2.0.4.dist-info}/LICENSE +0 -0
- {warp_beacon-2.0.2.dist-info → warp_beacon-2.0.4.dist-info}/WHEEL +0 -0
- {warp_beacon-2.0.2.dist-info → warp_beacon-2.0.4.dist-info}/entry_points.txt +0 -0
- {warp_beacon-2.0.2.dist-info → warp_beacon-2.0.4.dist-info}/top_level.txt +0 -0
warp_beacon/__version__.py
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
__version__ = "2.0.
|
1
|
+
__version__ = "2.0.4"
|
2
2
|
|
warp_beacon/telegram/bot.py
CHANGED
@@ -307,7 +307,7 @@ class Bot(object):
|
|
307
307
|
sent_messages += messages
|
308
308
|
if job.media_collection:
|
309
309
|
for j, chunk in enumerate(media_chunk):
|
310
|
-
tg_file_id = Utils.
|
310
|
+
tg_file_id = Utils.extract_file_id(messages[j])
|
311
311
|
if tg_file_id:
|
312
312
|
job.media_collection[i][j].tg_file_id = tg_file_id
|
313
313
|
if i == 0 and job.placeholder_message_id:
|
warp_beacon/telegram/handlers.py
CHANGED
@@ -17,6 +17,7 @@ import logging
|
|
17
17
|
class Handlers(object):
|
18
18
|
storage = None
|
19
19
|
bot = None
|
20
|
+
url_extractor = URLExtract()
|
20
21
|
|
21
22
|
def __init__(self, bot: "Bot") -> None:
|
22
23
|
self.bot = bot
|
@@ -55,10 +56,14 @@ class Handlers(object):
|
|
55
56
|
)
|
56
57
|
|
57
58
|
async def handler(self, client: Client, message: Message) -> None:
|
59
|
+
if message is None:
|
60
|
+
return
|
61
|
+
message_text = Utils.extract_message_text(message)
|
62
|
+
if not message_text:
|
63
|
+
return
|
58
64
|
chat = message.chat
|
59
65
|
effective_message_id = message.id
|
60
|
-
|
61
|
-
urls = extractor.find_urls(message.text)
|
66
|
+
urls = self.url_extractor.find_urls(message_text)
|
62
67
|
|
63
68
|
reply_text = "Wut?"
|
64
69
|
if not urls:
|
warp_beacon/telegram/utils.py
CHANGED
@@ -71,3 +71,12 @@ class Utils(object):
|
|
71
71
|
@staticmethod
|
72
72
|
def chunker(seq: list, size: int) -> list:
|
73
73
|
return (seq[pos:pos + size] for pos in range(0, len(seq), size))
|
74
|
+
|
75
|
+
@staticmethod
|
76
|
+
def extract_message_text(message: "Message") -> str:
|
77
|
+
if hasattr(message, "text") and message.text:
|
78
|
+
return message.text
|
79
|
+
if hasattr(message, "caption") and message.caption:
|
80
|
+
return message.caption
|
81
|
+
|
82
|
+
return ''
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: warp_beacon
|
3
|
-
Version: 2.0.
|
3
|
+
Version: 2.0.4
|
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
|
@@ -237,10 +237,17 @@ Requires-Dist: instagrapi ==2.0.0
|
|
237
237
|
|
238
238
|
# warp_beacon [](https://github.com/sb0y/warp_beacon/actions/workflows/python-publish.yml) [](https://github.com/sb0y/warp_beacon/actions/workflows/docker-image.yml) [](https://github.com/sb0y/warp_beacon/actions/workflows/build-deb.yml)
|
239
239
|
|
240
|
-
Telegram bot for external social networks media
|
241
|
-
Works with links in personal messages and also with group chats.
|
240
|
+
Telegram bot for external social networks media links expanding.
|
241
|
+
Works with a links in personal messages and also with group chats.
|
242
242
|
|
243
|
-
Just send
|
243
|
+
Just send a media link to the chat with bot and get a video or audio reply.
|
244
|
+
|
245
|
+
<img width="549" alt="image" src="https://github.com/user-attachments/assets/6d1cf0d8-4aa9-4852-90c9-6817974a7dd9">
|
246
|
+
|
247
|
+
In order to setup your own instance, you will need:
|
248
|
+
|
249
|
+
1. Obtain your own brand new `TG_TOKEN`. To do that, write to [@BotFather](https://t.me/BotFather).
|
250
|
+
2. Obtain `TG_API_ID`, `TG_API_HASH`, `TG_BOT_NAME`. Learn more [here](https://core.telegram.org/api/obtaining_api_id).
|
244
251
|
|
245
252
|
All bot configuration stored in [warp_beacon.conf](https://github.com/sb0y/warp_beacon/blob/main/etc/warp_beacon.conf) file.
|
246
253
|
|
@@ -248,6 +255,13 @@ All bot configuration stored in [warp_beacon.conf](https://github.com/sb0y/warp_
|
|
248
255
|
|
249
256
|
```env
|
250
257
|
TG_TOKEN="you telegram token received from @BotFather"
|
258
|
+
# these 3 settings should be obtained at https://my.telegram.org/apps
|
259
|
+
# learn more: https://core.telegram.org/api/obtaining_api_id
|
260
|
+
###
|
261
|
+
TG_API_ID=""
|
262
|
+
TG_API_HASH=""
|
263
|
+
TG_BOT_NAME=""
|
264
|
+
###
|
251
265
|
INSTAGRAM_LOGIN="instagram login (email or cell phone)"
|
252
266
|
INSTAGRAM_PASSWORD="instgram password"
|
253
267
|
INSTAGRAM_VERIFICATION_CODE="instagram 2FA if required, default empty"
|
@@ -256,7 +270,13 @@ MONGODB_PORT="27017"
|
|
256
270
|
MONGODB_USER="root"
|
257
271
|
MONGODB_PASSWORD="changeme"
|
258
272
|
VIDEO_STORAGE_DIR="/var/warp_beacon/videos"
|
259
|
-
|
273
|
+
# workers settings
|
274
|
+
# default: min(32, os.cpu_count() + 4)
|
275
|
+
#TG_WORKERS_POOL_SIZE=3
|
276
|
+
#UPLOAD_POOL_SIZE=3
|
277
|
+
#WORKERS_POOL_SIZE=3
|
278
|
+
ENABLE_DONATES=true
|
279
|
+
DONATE_LINK="your donate link which will be shown if ENABLE_DONATES where set"
|
260
280
|
```
|
261
281
|
## Deployed example bot ##
|
262
282
|
[Try it 🚀](https://t.me/anus_sebe_zablokiruy_bot)
|
@@ -355,3 +375,7 @@ build deb file
|
|
355
375
|
```bash
|
356
376
|
dpkg-buildpackage -us -uc -b
|
357
377
|
```
|
378
|
+
|
379
|
+
# Support Warp Beacon project
|
380
|
+
|
381
|
+
[<img src="https://cdn.cryptocloud.plus/brand/cc-group-black.png" alt="CryptoCloud Accepted" width="250px">](https://pay.cryptocloud.plus/pos/W5BMtNQt5bJFoW2E)
|
@@ -2,7 +2,7 @@ etc/warp_beacon/warp_beacon.conf,sha256=xihOuNBqVXGNdmMO14wwYNrqSQ4Z1wlAjp-xJk5S
|
|
2
2
|
lib/systemd/system/warp_beacon.service,sha256=lPmHqLqcI2eIV7nwHS0qcALQrznixqJuwwPfa2mDLUA,372
|
3
3
|
var/warp_beacon/placeholder.gif,sha256=cE5CGJVaop4Sx21zx6j4AyoHU0ncmvQuS2o6hJfEH88,6064
|
4
4
|
warp_beacon/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
|
-
warp_beacon/__version__.py,sha256=
|
5
|
+
warp_beacon/__version__.py,sha256=xiJvazFqLHY3NrizxeBtVSpbJqQHaThFbXg5e2xEE48,23
|
6
6
|
warp_beacon/warp_beacon.py,sha256=7KEtZDj-pdhtl6m-zFLsSojs1ZR4o7L0xbqtdmYPvfE,342
|
7
7
|
warp_beacon/compress/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
8
|
warp_beacon/compress/video.py,sha256=_PDMVYCyzLYxHv1uZmmzGcG_8rjaZr7BTXsXTTy_oS4,2846
|
@@ -27,14 +27,14 @@ warp_beacon/scraper/youtube/shorts.py,sha256=co4lpNTnncIEScVB9htAT2Hy4fvx56z5xgD
|
|
27
27
|
warp_beacon/scraper/youtube/youtube.py,sha256=xIrGe2ElPo3889_w5128xCnkdgwG1u6lA-QoachMUfc,1104
|
28
28
|
warp_beacon/storage/__init__.py,sha256=8XsJXq9X7GDlTaWREF4W1PDX9PH5utwhjf5c5M8Bb7o,3378
|
29
29
|
warp_beacon/telegram/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
30
|
-
warp_beacon/telegram/bot.py,sha256=
|
31
|
-
warp_beacon/telegram/handlers.py,sha256=
|
30
|
+
warp_beacon/telegram/bot.py,sha256=Jvude0RxL_-muB4uQtapeE2kNKxtWPdOuGgmBE7qSuA,12062
|
31
|
+
warp_beacon/telegram/handlers.py,sha256=7-uaRuUgOPAE0fX-fSbn0N02Pv5uELnEIBFxHPj3tTs,5908
|
32
32
|
warp_beacon/telegram/placeholder_message.py,sha256=u5kVfTjGmVYkwA5opniRltHXGpsdSxI41WEde8J5os0,6418
|
33
|
-
warp_beacon/telegram/utils.py,sha256=
|
33
|
+
warp_beacon/telegram/utils.py,sha256=1tm_DH1F2snDxSqwZnKD4ijvTrobv_kscgt3w-bWa6g,2027
|
34
34
|
warp_beacon/uploader/__init__.py,sha256=chX9oOrwO05O7DFmUfskTAnoKse66r3sY2s4NFF7bmM,4442
|
35
|
-
warp_beacon-2.0.
|
36
|
-
warp_beacon-2.0.
|
37
|
-
warp_beacon-2.0.
|
38
|
-
warp_beacon-2.0.
|
39
|
-
warp_beacon-2.0.
|
40
|
-
warp_beacon-2.0.
|
35
|
+
warp_beacon-2.0.4.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
36
|
+
warp_beacon-2.0.4.dist-info/METADATA,sha256=qLdBuZvEXCGX0a3ru-m965kk9rMxsQBFQg2N6RlZmBM,19287
|
37
|
+
warp_beacon-2.0.4.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
|
38
|
+
warp_beacon-2.0.4.dist-info/entry_points.txt,sha256=eSB61Rb89d56WY0O-vEIQwkn18J-4CMrJcLA_R_8h3g,119
|
39
|
+
warp_beacon-2.0.4.dist-info/top_level.txt,sha256=pu6xG8OO_nCGllnOfAZ6QpVfivtmHVxPlYK8SZzUDqA,840
|
40
|
+
warp_beacon-2.0.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|