warp-beacon 2.3.40__py3-none-any.whl → 2.3.42__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 +5 -4
- warp_beacon/scraper/youtube/music.py +54 -4
- warp_beacon/scraper/youtube/youtube.py +3 -3
- {warp_beacon-2.3.40.dist-info → warp_beacon-2.3.42.dist-info}/METADATA +1 -1
- {warp_beacon-2.3.40.dist-info → warp_beacon-2.3.42.dist-info}/RECORD +10 -10
- {warp_beacon-2.3.40.dist-info → warp_beacon-2.3.42.dist-info}/WHEEL +0 -0
- {warp_beacon-2.3.40.dist-info → warp_beacon-2.3.42.dist-info}/entry_points.txt +0 -0
- {warp_beacon-2.3.40.dist-info → warp_beacon-2.3.42.dist-info}/licenses/LICENSE +0 -0
- {warp_beacon-2.3.40.dist-info → warp_beacon-2.3.42.dist-info}/top_level.txt +0 -0
warp_beacon/__version__.py
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
__version__ = "2.3.
|
1
|
+
__version__ = "2.3.42"
|
2
2
|
|
@@ -279,12 +279,13 @@ class YoutubeAbstract(ScraperAbstract):
|
|
279
279
|
logging.warning("Proxy DSN malformed!")
|
280
280
|
return YouTube(**yt_opts)
|
281
281
|
|
282
|
-
def build_yt_dlp(self) -> yt_dlp.YoutubeDL:
|
282
|
+
def build_yt_dlp(self, timeout: int = 60) -> yt_dlp.YoutubeDL:
|
283
283
|
auth_data = {}
|
284
284
|
with open(self.YT_SESSION_FILE % self.account_index, 'r', encoding="utf-8") as f:
|
285
285
|
auth_data = json.loads(f.read())
|
286
286
|
time_name = str(time.time()).replace('.', '_')
|
287
287
|
ydl_opts = {
|
288
|
+
'socket_timeout': timeout,
|
288
289
|
'outtmpl': f'{self.DOWNLOAD_DIR}/{time_name}.%(ext)s',
|
289
290
|
'format': 'bestvideo+bestaudio/best',
|
290
291
|
'merge_output_format': 'mp4',
|
@@ -300,10 +301,10 @@ class YoutubeAbstract(ScraperAbstract):
|
|
300
301
|
|
301
302
|
return yt_dlp.YoutubeDL(ydl_opts)
|
302
303
|
|
303
|
-
def _download(self, _: str) -> list:
|
304
|
+
def _download(self, _: str, __: int = 60) -> list:
|
304
305
|
raise NotImplementedError("You should to implement _download method")
|
305
306
|
|
306
|
-
def _download_yt_dlp(self, _: str) -> list:
|
307
|
+
def _download_yt_dlp(self, _: str, __: int = 60) -> list:
|
307
308
|
raise NotImplementedError("You should to implement _download_yt_dlp method")
|
308
309
|
|
309
310
|
def download(self, job: DownloadJob) -> list:
|
@@ -317,6 +318,6 @@ class YoutubeAbstract(ScraperAbstract):
|
|
317
318
|
ret = self.download_hndlr(self._download_yt_dlp, job.url)
|
318
319
|
except NotImplementedError:
|
319
320
|
logging.info("yt_dlp is not supported for this submodule yet")
|
320
|
-
raise Unavailable("
|
321
|
+
raise Unavailable("Сontent unvailable")
|
321
322
|
|
322
323
|
return ret
|
@@ -1,8 +1,14 @@
|
|
1
|
+
import logging
|
2
|
+
|
3
|
+
import time
|
4
|
+
import json
|
5
|
+
|
6
|
+
import yt_dlp
|
7
|
+
|
1
8
|
from warp_beacon.jobs.types import JobType
|
2
9
|
from warp_beacon.scraper.youtube.abstract import YoutubeAbstract
|
3
10
|
from warp_beacon.scraper.exceptions import NotFound, FileTooBig
|
4
11
|
|
5
|
-
import logging
|
6
12
|
|
7
13
|
class YoutubeMusicScraper(YoutubeAbstract):
|
8
14
|
YT_MAX_RETRIES_DEFAULT = 6
|
@@ -13,10 +19,12 @@ class YoutubeMusicScraper(YoutubeAbstract):
|
|
13
19
|
def _download(self, url: str, session: bool = True, timeout: int = 0) -> list:
|
14
20
|
res = []
|
15
21
|
thumbnail = None
|
16
|
-
|
22
|
+
audio_id = self.get_video_id(url)
|
17
23
|
|
18
|
-
if
|
19
|
-
thumbnail = self.download_hndlr(self.download_thumbnail,
|
24
|
+
if audio_id:
|
25
|
+
thumbnail = self.download_hndlr(self.download_thumbnail, audio_id)
|
26
|
+
|
27
|
+
yt = self.build_yt(url, session=session)
|
20
28
|
|
21
29
|
stream = yt.streams.get_audio_only()
|
22
30
|
|
@@ -45,3 +53,45 @@ class YoutubeMusicScraper(YoutubeAbstract):
|
|
45
53
|
})
|
46
54
|
|
47
55
|
return res
|
56
|
+
|
57
|
+
def build_yt_dlp(self, timeout: int = 60) -> yt_dlp.YoutubeDL:
|
58
|
+
auth_data = {}
|
59
|
+
with open(self.YT_SESSION_FILE % self.account_index, 'r', encoding="utf-8") as f:
|
60
|
+
auth_data = json.loads(f.read())
|
61
|
+
time_name = str(time.time()).replace('.', '_')
|
62
|
+
ydl_opts = {
|
63
|
+
'socket_timeout': timeout,
|
64
|
+
'outtmpl': f'{self.DOWNLOAD_DIR}/{time_name}.%(ext)s',
|
65
|
+
'format': 'bestaudio[ext=m4a]/bestaudio/best',
|
66
|
+
'noplaylist': True,
|
67
|
+
'keepvideo': False,
|
68
|
+
'tv_auth': auth_data
|
69
|
+
}
|
70
|
+
|
71
|
+
if self.proxy:
|
72
|
+
proxy_dsn = self.proxy.get("dsn", "")
|
73
|
+
logging.info("Using proxy DSN '%s'", proxy_dsn)
|
74
|
+
if proxy_dsn:
|
75
|
+
ydl_opts["proxy"] = proxy_dsn
|
76
|
+
|
77
|
+
return yt_dlp.YoutubeDL(ydl_opts)
|
78
|
+
|
79
|
+
def _download_yt_dlp(self, url: str, timeout: int = 60) -> list:
|
80
|
+
res = []
|
81
|
+
thumbnail = None
|
82
|
+
video_id = self.get_video_id(url)
|
83
|
+
if video_id:
|
84
|
+
thumbnail = self.download_hndlr(self.download_thumbnail, video_id)
|
85
|
+
with self.build_yt_dlp(timeout) as ydl:
|
86
|
+
info = ydl.extract_info(url, download=True)
|
87
|
+
local_file = ydl.prepare_filename(info)
|
88
|
+
logging.debug("Temp filename: '%s'", local_file)
|
89
|
+
res.append({
|
90
|
+
"local_media_path": local_file,
|
91
|
+
"performer": info.get("uploader", "Unknown"),
|
92
|
+
"thumb": thumbnail,
|
93
|
+
"canonical_name": info.get("title", ''),
|
94
|
+
"media_type": JobType.AUDIO
|
95
|
+
})
|
96
|
+
|
97
|
+
return res
|
@@ -28,7 +28,7 @@ class YoutubeScraper(YoutubeAbstract):
|
|
28
28
|
|
29
29
|
return False
|
30
30
|
|
31
|
-
def _download(self, url: str, session: bool = True, timeout: int =
|
31
|
+
def _download(self, url: str, session: bool = True, timeout: int = 60) -> list:
|
32
32
|
res = []
|
33
33
|
try:
|
34
34
|
thumbnail = None
|
@@ -67,13 +67,13 @@ class YoutubeScraper(YoutubeAbstract):
|
|
67
67
|
|
68
68
|
return res
|
69
69
|
|
70
|
-
def _download_yt_dlp(self, url: str) -> list:
|
70
|
+
def _download_yt_dlp(self, url: str, timeout: int = 60) -> list:
|
71
71
|
res = []
|
72
72
|
thumbnail = None
|
73
73
|
video_id = self.get_video_id(url)
|
74
74
|
if video_id:
|
75
75
|
thumbnail = self.download_hndlr(self.download_thumbnail, video_id)
|
76
|
-
with self.build_yt_dlp() as ydl:
|
76
|
+
with self.build_yt_dlp(timeout) as ydl:
|
77
77
|
info = ydl.extract_info(url, download=True)
|
78
78
|
local_file = ydl.prepare_filename(info)
|
79
79
|
logging.debug("Temp filename: '%s'", local_file)
|
@@ -4,7 +4,7 @@ var/warp_beacon/accounts.json,sha256=OsXdncs6h88xrF_AP6_WDCK1waGBn9SR-uYdIeK37GM
|
|
4
4
|
var/warp_beacon/placeholder.gif,sha256=cE5CGJVaop4Sx21zx6j4AyoHU0ncmvQuS2o6hJfEH88,6064
|
5
5
|
var/warp_beacon/proxies.json,sha256=VnjlQDXumOEq72ZFjbh6IqHS1TEHqn8HPYAZqWCeSIA,95
|
6
6
|
warp_beacon/__init__.py,sha256=_rThNODmz0nDp_n4mWo_HKaNFE5jk1_7cRhHyYaencI,163
|
7
|
-
warp_beacon/__version__.py,sha256=
|
7
|
+
warp_beacon/__version__.py,sha256=HdlmwXDCQDYN5w-6-W575xg8eNbdzr_LRa9GUAwlJV8,24
|
8
8
|
warp_beacon/warp_beacon.py,sha256=7KEtZDj-pdhtl6m-zFLsSojs1ZR4o7L0xbqtdmYPvfE,342
|
9
9
|
warp_beacon/compress/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
10
|
warp_beacon/compress/video.py,sha256=_PDMVYCyzLYxHv1uZmmzGcG_8rjaZr7BTXsXTTy_oS4,2846
|
@@ -30,10 +30,10 @@ warp_beacon/scraper/link_resolver.py,sha256=Rc9ZuMyOo3iPywDHwjngy-WRQ2SXhJwxcg-5
|
|
30
30
|
warp_beacon/scraper/instagram/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
31
31
|
warp_beacon/scraper/instagram/instagram.py,sha256=TpIBS9S3zcLbeGax4CENVo6WP75EE6oIttc-MjWYVjs,13815
|
32
32
|
warp_beacon/scraper/youtube/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
33
|
-
warp_beacon/scraper/youtube/abstract.py,sha256=
|
34
|
-
warp_beacon/scraper/youtube/music.py,sha256=
|
33
|
+
warp_beacon/scraper/youtube/abstract.py,sha256=PC4vuKilPInD8dY_QL2xd38hEYToFf4soeS3tk_IcS8,11709
|
34
|
+
warp_beacon/scraper/youtube/music.py,sha256=dtS5_t3TToai2Ui05kjo9ecqz94G7g0K-5fAfw5pwGQ,2800
|
35
35
|
warp_beacon/scraper/youtube/shorts.py,sha256=k3yGF9b8HTzNE6h4VE0zsMGB6kWP-V2xiLhIY3QZXvs,1269
|
36
|
-
warp_beacon/scraper/youtube/youtube.py,sha256=
|
36
|
+
warp_beacon/scraper/youtube/youtube.py,sha256=B1NBz6vv0-zIuf3MDmT2QB7eX2qO8k9orj7-4wU6MBk,2839
|
37
37
|
warp_beacon/storage/__init__.py,sha256=0Vajd0oITKJfu2vmNx5uQSt3-L6vwIvUYWJo8HZCjco,3398
|
38
38
|
warp_beacon/storage/mongo.py,sha256=qC4ZiO8XXvPnP0rJwz4CJx42pqFsyAjCiW10W5QdT6E,527
|
39
39
|
warp_beacon/telegram/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -43,9 +43,9 @@ warp_beacon/telegram/handlers.py,sha256=XXIfdV_RCj7tyZMPXchuKmGoDdweOaR08ADDaBPW
|
|
43
43
|
warp_beacon/telegram/placeholder_message.py,sha256=wN9-BRiyrtHG-EvXtZkGJHt2CX71munQ57ITttjt0mw,6400
|
44
44
|
warp_beacon/telegram/utils.py,sha256=9uebX53G16mV7ER7WgfdWBLFHHw14S8HBt9URrIskg0,4440
|
45
45
|
warp_beacon/uploader/__init__.py,sha256=E9rlZIf7xlQz6MutMOwJ8S5Vm2uheR5nv23Kv8duRQg,5427
|
46
|
-
warp_beacon-2.3.
|
47
|
-
warp_beacon-2.3.
|
48
|
-
warp_beacon-2.3.
|
49
|
-
warp_beacon-2.3.
|
50
|
-
warp_beacon-2.3.
|
51
|
-
warp_beacon-2.3.
|
46
|
+
warp_beacon-2.3.42.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
47
|
+
warp_beacon-2.3.42.dist-info/METADATA,sha256=ZliwioNGg2vnLPNoHnkybvcqshw758tzdp51tQFAxNU,22626
|
48
|
+
warp_beacon-2.3.42.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
|
49
|
+
warp_beacon-2.3.42.dist-info/entry_points.txt,sha256=eSB61Rb89d56WY0O-vEIQwkn18J-4CMrJcLA_R_8h3g,119
|
50
|
+
warp_beacon-2.3.42.dist-info/top_level.txt,sha256=qGjHVVfyf6lTmbdSA-fQq0rHS1YVS4HoJT3rag5xgPE,1141
|
51
|
+
warp_beacon-2.3.42.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|