warp-beacon 2.0.5__tar.gz → 2.0.6__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.
Files changed (50) hide show
  1. {warp_beacon-2.0.5/warp_beacon.egg-info → warp_beacon-2.0.6}/PKG-INFO +1 -1
  2. warp_beacon-2.0.6/warp_beacon/__version__.py +2 -0
  3. {warp_beacon-2.0.5 → warp_beacon-2.0.6}/warp_beacon/scraper/__init__.py +9 -1
  4. {warp_beacon-2.0.5 → warp_beacon-2.0.6}/warp_beacon/scraper/exceptions.py +3 -0
  5. warp_beacon-2.0.6/warp_beacon/scraper/youtube/youtube.py +66 -0
  6. {warp_beacon-2.0.5 → warp_beacon-2.0.6/warp_beacon.egg-info}/PKG-INFO +1 -1
  7. warp_beacon-2.0.5/warp_beacon/__version__.py +0 -2
  8. warp_beacon-2.0.5/warp_beacon/scraper/youtube/youtube.py +0 -41
  9. {warp_beacon-2.0.5 → warp_beacon-2.0.6}/LICENSE +0 -0
  10. {warp_beacon-2.0.5 → warp_beacon-2.0.6}/MANIFEST.in +0 -0
  11. {warp_beacon-2.0.5 → warp_beacon-2.0.6}/README.md +0 -0
  12. {warp_beacon-2.0.5 → warp_beacon-2.0.6}/assets/placeholder.gif +0 -0
  13. {warp_beacon-2.0.5 → warp_beacon-2.0.6}/etc/.gitignore +0 -0
  14. {warp_beacon-2.0.5 → warp_beacon-2.0.6}/etc/warp_beacon.conf +0 -0
  15. {warp_beacon-2.0.5 → warp_beacon-2.0.6}/etc/warp_beacon.service +0 -0
  16. {warp_beacon-2.0.5 → warp_beacon-2.0.6}/pyproject.toml +0 -0
  17. {warp_beacon-2.0.5 → warp_beacon-2.0.6}/setup.cfg +0 -0
  18. {warp_beacon-2.0.5 → warp_beacon-2.0.6}/setup.py +0 -0
  19. {warp_beacon-2.0.5 → warp_beacon-2.0.6}/warp_beacon/__init__.py +0 -0
  20. {warp_beacon-2.0.5 → warp_beacon-2.0.6}/warp_beacon/compress/__init__.py +0 -0
  21. {warp_beacon-2.0.5 → warp_beacon-2.0.6}/warp_beacon/compress/video.py +0 -0
  22. {warp_beacon-2.0.5 → warp_beacon-2.0.6}/warp_beacon/jobs/__init__.py +0 -0
  23. {warp_beacon-2.0.5 → warp_beacon-2.0.6}/warp_beacon/jobs/abstract.py +0 -0
  24. {warp_beacon-2.0.5 → warp_beacon-2.0.6}/warp_beacon/jobs/download_job.py +0 -0
  25. {warp_beacon-2.0.5 → warp_beacon-2.0.6}/warp_beacon/jobs/types.py +0 -0
  26. {warp_beacon-2.0.5 → warp_beacon-2.0.6}/warp_beacon/jobs/upload_job.py +0 -0
  27. {warp_beacon-2.0.5 → warp_beacon-2.0.6}/warp_beacon/mediainfo/__init__.py +0 -0
  28. {warp_beacon-2.0.5 → warp_beacon-2.0.6}/warp_beacon/mediainfo/abstract.py +0 -0
  29. {warp_beacon-2.0.5 → warp_beacon-2.0.6}/warp_beacon/mediainfo/audio.py +0 -0
  30. {warp_beacon-2.0.5 → warp_beacon-2.0.6}/warp_beacon/mediainfo/silencer.py +0 -0
  31. {warp_beacon-2.0.5 → warp_beacon-2.0.6}/warp_beacon/mediainfo/video.py +0 -0
  32. {warp_beacon-2.0.5 → warp_beacon-2.0.6}/warp_beacon/scraper/abstract.py +0 -0
  33. {warp_beacon-2.0.5 → warp_beacon-2.0.6}/warp_beacon/scraper/instagram.py +0 -0
  34. {warp_beacon-2.0.5 → warp_beacon-2.0.6}/warp_beacon/scraper/youtube/__init__.py +0 -0
  35. {warp_beacon-2.0.5 → warp_beacon-2.0.6}/warp_beacon/scraper/youtube/abstract.py +0 -0
  36. {warp_beacon-2.0.5 → warp_beacon-2.0.6}/warp_beacon/scraper/youtube/music.py +0 -0
  37. {warp_beacon-2.0.5 → warp_beacon-2.0.6}/warp_beacon/scraper/youtube/shorts.py +0 -0
  38. {warp_beacon-2.0.5 → warp_beacon-2.0.6}/warp_beacon/storage/__init__.py +0 -0
  39. {warp_beacon-2.0.5 → warp_beacon-2.0.6}/warp_beacon/telegram/__init__.py +0 -0
  40. {warp_beacon-2.0.5 → warp_beacon-2.0.6}/warp_beacon/telegram/bot.py +0 -0
  41. {warp_beacon-2.0.5 → warp_beacon-2.0.6}/warp_beacon/telegram/handlers.py +0 -0
  42. {warp_beacon-2.0.5 → warp_beacon-2.0.6}/warp_beacon/telegram/placeholder_message.py +0 -0
  43. {warp_beacon-2.0.5 → warp_beacon-2.0.6}/warp_beacon/telegram/utils.py +0 -0
  44. {warp_beacon-2.0.5 → warp_beacon-2.0.6}/warp_beacon/uploader/__init__.py +0 -0
  45. {warp_beacon-2.0.5 → warp_beacon-2.0.6}/warp_beacon/warp_beacon.py +0 -0
  46. {warp_beacon-2.0.5 → warp_beacon-2.0.6}/warp_beacon.egg-info/SOURCES.txt +0 -0
  47. {warp_beacon-2.0.5 → warp_beacon-2.0.6}/warp_beacon.egg-info/dependency_links.txt +0 -0
  48. {warp_beacon-2.0.5 → warp_beacon-2.0.6}/warp_beacon.egg-info/entry_points.txt +0 -0
  49. {warp_beacon-2.0.5 → warp_beacon-2.0.6}/warp_beacon.egg-info/requires.txt +0 -0
  50. {warp_beacon-2.0.5 → warp_beacon-2.0.6}/warp_beacon.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: warp_beacon
3
- Version: 2.0.5
3
+ Version: 2.0.6
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
@@ -0,0 +1,2 @@
1
+ __version__ = "2.0.6"
2
+
@@ -5,7 +5,7 @@ from typing import Optional
5
5
  import multiprocessing
6
6
  from queue import Empty
7
7
 
8
- from warp_beacon.scraper.exceptions import NotFound, UnknownError, TimeOut, Unavailable, FileTooBig
8
+ from warp_beacon.scraper.exceptions import NotFound, UnknownError, TimeOut, Unavailable, FileTooBig, YotubeLiveError
9
9
  from warp_beacon.mediainfo.video import VideoInfo
10
10
  from warp_beacon.mediainfo.audio import AudioInfo
11
11
  from warp_beacon.mediainfo.silencer import Silencer
@@ -115,6 +115,14 @@ class AsyncDownloader(object):
115
115
  job_failed_msg="Unfortunately this file has exceeded the Telegram limits. A file cannot be larger than 2 gigabytes.")
116
116
  )
117
117
  break
118
+ except YotubeLiveError as e:
119
+ logging.warning("Youtube Live videos are not supported. Skipping.")
120
+ logging.exception(e)
121
+ self.uploader.queue_task(job.to_upload_job(
122
+ job_failed=True,
123
+ job_failed_msg="Youtube Live videos are not supported. Please wait until the live broadcast ends.")
124
+ )
125
+ break
118
126
  except (UnknownError, Exception) as e:
119
127
  logging.warning("UnknownError occurred!")
120
128
  logging.exception(e)
@@ -28,6 +28,9 @@ class NotFound(ScraperError):
28
28
  class Unavailable(ScraperError):
29
29
  pass
30
30
 
31
+ class YotubeLiveError(ScraperError):
32
+ pass
33
+
31
34
  class UnknownError(ScraperError):
32
35
  pass
33
36
 
@@ -0,0 +1,66 @@
1
+ from warp_beacon.jobs.types import JobType
2
+ from warp_beacon.scraper.youtube.abstract import YoutubeAbstract
3
+ from warp_beacon.scraper.exceptions import YotubeLiveError, NotFound
4
+
5
+ from pytubefix import YouTube
6
+
7
+ import logging
8
+
9
+ class YoutubeScraper(YoutubeAbstract):
10
+ YT_MAX_RETRIES_DEFAULT = 8
11
+ YT_PAUSE_BEFORE_RETRY_DEFAULT = 3
12
+ YT_TIMEOUT_DEFAULT = 2
13
+ YT_TIMEOUT_INCREMENT_DEFAULT = 60
14
+
15
+ def is_live(self, data: dict) -> bool:
16
+ '''
17
+ x.contents.twoColumnWatchNextResults.results.results.contents[0].videoPrimaryInfoRenderer.viewCount.videoViewCountRenderer.isLive
18
+ '''
19
+ try:
20
+ contents = data.get("contents", {}).get("twoColumnWatchNextResults", {}).get("results", {}).get("results", {}).get("contents", [])
21
+ for i in contents:
22
+ video_view_count_renderer = i.get("videoPrimaryInfoRenderer", {}).get("viewCount", {}).get("videoViewCountRenderer", {})
23
+ if video_view_count_renderer:
24
+ return video_view_count_renderer.get("isLive", False)
25
+ except Exception as e:
26
+ logging.warning("Failed to check if stream is live!")
27
+ logging.exception(e)
28
+
29
+ return False
30
+
31
+ def _download(self, url: str, timeout: int = 0) -> list:
32
+ res = []
33
+ thumbnail = None
34
+ yt = YouTube(url)
35
+
36
+ if self.is_live(yt.initial_data):
37
+ raise YotubeLiveError("Youtube Live is not supported")
38
+
39
+ if yt and yt.thumbnail_url:
40
+ thumbnail = self.download_thumbnail(yt.thumbnail_url)
41
+
42
+ stream = yt.streams.get_highest_resolution()
43
+
44
+ if not stream:
45
+ raise NotFound("No suitable video stream found")
46
+
47
+ local_file = stream.download(
48
+ output_path=self.DOWNLOAD_DIR,
49
+ max_retries=0,
50
+ timeout=timeout,
51
+ skip_existing=False,
52
+ filename_prefix="yt_download_"
53
+ )
54
+ logging.debug("Temp filename: '%s'", local_file)
55
+ res.append({
56
+ "local_media_path": self.rename_local_file(local_file),
57
+ "performer": yt.author,
58
+ "thumb": thumbnail,
59
+ "canonical_name": stream.title,
60
+ "media_type": JobType.VIDEO
61
+ })
62
+
63
+ return res
64
+
65
+ def download(self, url: str) -> list:
66
+ return self._download_hndlr(self._download, url)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: warp_beacon
3
- Version: 2.0.5
3
+ Version: 2.0.6
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
@@ -1,2 +0,0 @@
1
- __version__ = "2.0.5"
2
-
@@ -1,41 +0,0 @@
1
- from warp_beacon.jobs.types import JobType
2
- from warp_beacon.scraper.youtube.abstract import YoutubeAbstract
3
-
4
- from pytubefix import YouTube
5
-
6
- import logging
7
-
8
- class YoutubeScraper(YoutubeAbstract):
9
- YT_MAX_RETRIES_DEFAULT = 8
10
- YT_PAUSE_BEFORE_RETRY_DEFAULT = 3
11
- YT_TIMEOUT_DEFAULT = 2
12
- YT_TIMEOUT_INCREMENT_DEFAULT = 60
13
-
14
- def _download(self, url: str, timeout: int = 0) -> list:
15
- res = []
16
- thumbnail = None
17
- yt = YouTube(url)
18
- if yt and yt.thumbnail_url:
19
- thumbnail = self.download_thumbnail(yt.thumbnail_url)
20
- stream = yt.streams.get_highest_resolution()
21
- if stream:
22
- local_file = stream.download(
23
- output_path=self.DOWNLOAD_DIR,
24
- max_retries=0,
25
- timeout=timeout,
26
- skip_existing=False,
27
- filename_prefix="yt_download_"
28
- )
29
- logging.debug("Temp filename: '%s'", local_file)
30
- res.append({
31
- "local_media_path": self.rename_local_file(local_file),
32
- "performer": yt.author,
33
- "thumb": thumbnail,
34
- "canonical_name": stream.title,
35
- "media_type": JobType.VIDEO
36
- })
37
-
38
- return res
39
-
40
- def download(self, url: str) -> list:
41
- return self._download_hndlr(self._download, url)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes