warp-beacon 2.6.10__tar.gz → 2.6.12__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.10/warp_beacon.egg-info → warp_beacon-2.6.12}/PKG-INFO +1 -1
- warp_beacon-2.6.12/warp_beacon/__version__.py +2 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon/jobs/download_job.py +4 -6
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon/scraper/__init__.py +6 -3
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon/scraper/youtube/youtube.py +28 -2
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon/warp_beacon.py +6 -2
- {warp_beacon-2.6.10 → warp_beacon-2.6.12/warp_beacon.egg-info}/PKG-INFO +1 -1
- warp_beacon-2.6.10/warp_beacon/__version__.py +0 -2
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/LICENSE +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/MANIFEST.in +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/README.md +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/assets/placeholder.gif +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/etc/.gitignore +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/etc/accounts.json +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/etc/proxies.json +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/etc/warp_beacon.conf +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/etc/warp_beacon.service +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/pyproject.toml +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/setup.cfg +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/setup.py +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon/__init__.py +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon/compress/__init__.py +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon/compress/video.py +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon/jobs/__init__.py +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon/jobs/abstract.py +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon/jobs/types.py +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon/jobs/upload_job.py +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon/mediainfo/__init__.py +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon/mediainfo/abstract.py +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon/mediainfo/audio.py +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon/mediainfo/silencer.py +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon/mediainfo/video.py +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon/scheduler/__init__.py +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon/scheduler/instagram_human.py +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon/scheduler/scheduler.py +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon/scraper/abstract.py +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon/scraper/account_selector.py +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon/scraper/exceptions.py +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon/scraper/fail_handler.py +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon/scraper/instagram/__init__.py +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon/scraper/instagram/captcha.py +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon/scraper/instagram/instagram.py +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon/scraper/link_resolver.py +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon/scraper/youtube/__init__.py +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon/scraper/youtube/abstract.py +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon/scraper/youtube/music.py +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon/scraper/youtube/shorts.py +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon/storage/__init__.py +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon/storage/mongo.py +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon/telegram/__init__.py +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon/telegram/bot.py +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon/telegram/caption_shortener.py +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon/telegram/handlers.py +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon/telegram/placeholder_message.py +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon/telegram/utils.py +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon/uploader/__init__.py +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon/yt_auth.py +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon.egg-info/SOURCES.txt +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon.egg-info/dependency_links.txt +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon.egg-info/entry_points.txt +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon.egg-info/requires.txt +0 -0
- {warp_beacon-2.6.10 → warp_beacon-2.6.12}/warp_beacon.egg-info/top_level.txt +0 -0
@@ -1,16 +1,14 @@
|
|
1
|
-
from typing import TypedDict
|
1
|
+
#from typing import TypedDict
|
2
2
|
from typing_extensions import Unpack
|
3
3
|
|
4
4
|
from warp_beacon.jobs.upload_job import UploadJob
|
5
5
|
from warp_beacon.jobs.abstract import AbstractJob, JobSettings
|
6
6
|
|
7
|
-
import logging
|
7
|
+
#import logging
|
8
8
|
|
9
9
|
class DownloadJob(AbstractJob):
|
10
10
|
def __init__(self, **kwargs: Unpack[JobSettings]) -> None:
|
11
11
|
super(DownloadJob, self).__init__(**kwargs)
|
12
|
-
def __del__(self) -> None:
|
13
|
-
pass
|
14
12
|
|
15
13
|
@staticmethod
|
16
14
|
def build(**kwargs: Unpack[JobSettings]) -> "DownloadJob":
|
@@ -20,7 +18,7 @@ class DownloadJob(AbstractJob):
|
|
20
18
|
d = self.to_dict()
|
21
19
|
d.update(kwargs)
|
22
20
|
if "media_collection" in d:
|
23
|
-
for index,
|
24
|
-
for k,
|
21
|
+
for index, _ in enumerate(d["media_collection"]):
|
22
|
+
for k, _ in enumerate(d["media_collection"][index]):
|
25
23
|
d["media_collection"][index][k] = UploadJob.build(**d["media_collection"][index][k])
|
26
24
|
return UploadJob.build(**d)
|
@@ -29,17 +29,20 @@ PROXY_FILE = os.environ.get("PROXY_FILE", default="/var/warp_beacon/proxies.json
|
|
29
29
|
class AsyncDownloader(object):
|
30
30
|
TG_FILE_LIMIT = 2147483648 # 2 GiB
|
31
31
|
__JOE_BIDEN_WAKEUP = None
|
32
|
-
workers =
|
32
|
+
workers = None
|
33
33
|
allow_loop = None
|
34
|
-
job_queue =
|
34
|
+
job_queue = None
|
35
35
|
uploader = None
|
36
36
|
workers_count = 0
|
37
|
-
auth_event =
|
37
|
+
auth_event = None
|
38
38
|
manager = None
|
39
39
|
acc_selector = None
|
40
40
|
scheduler = None
|
41
41
|
|
42
42
|
def __init__(self, uploader: AsyncUploader, workers_count: int) -> None:
|
43
|
+
self.workers = []
|
44
|
+
self.job_queue = multiprocessing.Queue()
|
45
|
+
self.auth_event = multiprocessing.Event()
|
43
46
|
self.manager = multiprocessing.Manager()
|
44
47
|
self.allow_loop = self.manager.Value('i', 1)
|
45
48
|
self.acc_selector = AccountSelector(self.manager, ACC_FILE, PROXY_FILE)
|
@@ -78,6 +78,9 @@ class YoutubeScraper(YoutubeAbstract):
|
|
78
78
|
|
79
79
|
video_stream = yt.streams.filter(adaptive=True, file_extension='mp4', only_video=True).order_by('resolution').desc().first()
|
80
80
|
audio_stream = yt.streams.filter(adaptive=True, file_extension='mp4', only_audio=True).order_by('abr').desc().first()
|
81
|
+
size_in_bytes = video_stream.filesize + audio_stream.filesize
|
82
|
+
if size_in_bytes > 2147483648: # 2 GiB
|
83
|
+
video_stream = yt.streams.filter(adaptive=True, file_extension='mp4', only_video=True, res='720p').order_by('resolution').desc().first()
|
81
84
|
|
82
85
|
local_video_file = video_stream.download(
|
83
86
|
output_path=self.DOWNLOAD_DIR,
|
@@ -161,7 +164,30 @@ class YoutubeScraper(YoutubeAbstract):
|
|
161
164
|
def _download_yt_dlp(self, url: str, thumbnail: Optional[io.BytesIO] = None, timeout: int = 60) -> list:
|
162
165
|
res = []
|
163
166
|
with self.build_yt_dlp(timeout) as ydl:
|
164
|
-
info = ydl.extract_info(url, download=
|
167
|
+
info = ydl.extract_info(url, download=False)
|
168
|
+
formats = info.get('formats', [])
|
169
|
+
|
170
|
+
dl_format = {}
|
171
|
+
for f in sorted(formats, key=lambda x: (x.get('height', 0) or 0), reverse=True):
|
172
|
+
if f.get('vcodec', '') != 'none' and f.get('acodec', '') != 'none' and f.get('ext', '') == 'mp4':
|
173
|
+
dl_format = f
|
174
|
+
break
|
175
|
+
|
176
|
+
filesize = dl_format.get('filesize', 0) or dl_format.get('filesize_approx', 0)
|
177
|
+
if filesize:
|
178
|
+
if filesize > 2147483648: # 2 GiB
|
179
|
+
logging.warning("Max resolution exceeding TG limits")
|
180
|
+
for f in sorted(formats, key=lambda x: (x.get('height', 0) or 0), reverse=True):
|
181
|
+
if (f.get('vcodec', '') != 'none' and f.get('acodec', '') != 'none'
|
182
|
+
and (f.get('height', 0) or 0) <= 720 and f.get('ext', '') == 'mp4'):
|
183
|
+
alt_filesize = f.get('filesize', 0) or f.get('filesize_approx', 0)
|
184
|
+
if alt_filesize: #and alt_filesize <= max_size_bytes:
|
185
|
+
dl_format = f
|
186
|
+
break
|
187
|
+
else:
|
188
|
+
logging.warning("Unknown filesize!")
|
189
|
+
ydl.params['format'] = dl_format['format_id']
|
190
|
+
ydl.download([url])
|
165
191
|
local_file = ydl.prepare_filename(info)
|
166
192
|
logging.debug("Temp filename: '%s'", local_file)
|
167
193
|
res.append({
|
@@ -172,4 +198,4 @@ class YoutubeScraper(YoutubeAbstract):
|
|
172
198
|
"media_type": JobType.VIDEO
|
173
199
|
})
|
174
200
|
|
175
|
-
return res
|
201
|
+
return res
|
@@ -2,13 +2,17 @@ import os
|
|
2
2
|
|
3
3
|
from warp_beacon.telegram.bot import Bot
|
4
4
|
|
5
|
-
import logging
|
5
|
+
#import logging
|
6
6
|
|
7
7
|
def main() -> None:
|
8
|
+
if __name__ == "__main__":
|
9
|
+
run()
|
10
|
+
|
11
|
+
def run() -> None:
|
8
12
|
bot = Bot(
|
9
13
|
tg_bot_name=os.environ.get("TG_BOT_NAME", default=None),
|
10
14
|
tg_token=os.environ.get("TG_TOKEN", default=None),
|
11
15
|
tg_api_id=os.environ.get("TG_API_ID", default=None),
|
12
16
|
tg_api_hash=os.environ.get("TG_API_HASH", default=None)
|
13
17
|
)
|
14
|
-
bot.start()
|
18
|
+
bot.start()
|
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
|