warp-beacon 2.3.1__py3-none-any.whl → 2.3.3__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.
@@ -1,2 +1,2 @@
1
- __version__ = "2.3.1"
1
+ __version__ = "2.3.3"
2
2
 
@@ -1,5 +1,4 @@
1
-
2
- #import numpy as np
1
+ import numpy as np
3
2
  import av
4
3
 
5
4
  from warp_beacon.mediainfo.video import VideoInfo
@@ -28,10 +27,14 @@ class Silencer(VideoInfo):
28
27
  if packet:
29
28
  out_container.mux(packet)
30
29
  #
31
- aframe = av.AudioFrame(samples=64, format='s16')
30
+ silent_samples = 64
31
+ silent_data = np.zeros((1, silent_samples), dtype=np.int16)
32
+ #aframe = av.AudioFrame(samples=64, format='s16')
33
+ aframe = av.AudioFrame.from_ndarray(silent_data, layout='mono')
32
34
  aframe.pts = frame.pts
33
- aframe.sample_rate = 16000
34
- aframe.rate = 44100
35
+ aframe.sample_rate = 44100
36
+ #aframe.rate = 44100
37
+
35
38
  for packet in out_audio_stream.encode(aframe):
36
39
  out_container.mux(packet)
37
40
 
@@ -1,4 +1,5 @@
1
1
  import os
2
+ import random
2
3
  import json
3
4
  import re
4
5
  from typing import Optional
@@ -44,11 +45,16 @@ class AccountSelector(object):
44
45
  if self.proxies:
45
46
  try:
46
47
  current_acc_pid = self.get_current()[1].get("proxy_id", "").strip()
48
+ matched_proxy = []
47
49
  for proxy in self.proxies:
48
50
  pid = proxy.get("id", "").strip()
49
51
  if pid and current_acc_pid and pid == current_acc_pid:
50
52
  logging.info("Account proxy matched '%s'", proxy)
51
- return proxy
53
+ matched_proxy.append(proxy)
54
+ if matched_proxy:
55
+ prox_choice = random.choice(matched_proxy)
56
+ logging.info("Chosen proxy: '%s'", prox_choice)
57
+ return prox_choice
52
58
  except Exception as e:
53
59
  logging.warning("Error on selecting account proxy!")
54
60
  logging.exception(e)
@@ -33,6 +33,7 @@ INST_SESSION_FILE_TPL = "/var/warp_beacon/inst_session_account_%d.json"
33
33
  class InstagramScraper(ScraperAbstract):
34
34
  cl = None
35
35
  inst_session_file = ""
36
+ timeline_cursor = {}
36
37
 
37
38
  def __init__(self, account: tuple, proxy: dict=None) -> None:
38
39
  super().__init__(account, proxy)
@@ -71,9 +72,11 @@ class InstagramScraper(ScraperAbstract):
71
72
  })
72
73
 
73
74
  def safe_write_session(self) -> None:
75
+ cl_settings = self.cl.get_settings()
76
+ cl_settings["warp_timeline_cursor"] = self.timeline_cursor
74
77
  tmp_fname = "%s~" % self.inst_session_file
75
78
  with open(tmp_fname, 'w+', encoding="utf-8") as f:
76
- f.write(json.dumps(self.cl.get_settings()))
79
+ f.write(json.dumps(cl_settings))
77
80
  if os.path.exists(self.inst_session_file):
78
81
  os.unlink(self.inst_session_file)
79
82
  os.rename(tmp_fname, self.inst_session_file)
@@ -81,7 +84,12 @@ class InstagramScraper(ScraperAbstract):
81
84
  def load_session(self) -> None:
82
85
  if os.path.exists(self.inst_session_file):
83
86
  logging.info("Loading existing session file '%s'", self.inst_session_file)
84
- self.cl.load_settings(self.inst_session_file)
87
+ with open(self.inst_session_file, 'r', encoding="utf-8") as f:
88
+ js = json.loads(f.read())
89
+ if "warp_timeline_cursor" in js:
90
+ self.timeline_cursor = js.get("warp_timeline_cursor", {})
91
+ del js["warp_timeline_cursor"]
92
+ self.cl.set_settings(js)
85
93
  else:
86
94
  self._download_hndlr(self.login)
87
95
 
@@ -94,7 +102,7 @@ class InstagramScraper(ScraperAbstract):
94
102
 
95
103
  def validate_session(self) -> None:
96
104
  self.load_session()
97
- self._download_hndlr(self.cl.get_timeline_feed)
105
+ self.timeline_cursor = self._download_hndlr(self.cl.get_timeline_feed, "pull_to_refresh", self.timeline_cursor.get("next_max_id", None))
98
106
  self._download_hndlr(self.cl.get_reels_tray_feed, "pull_to_refresh")
99
107
  self._download_hndlr(self.cl.direct_active_presence)
100
108
  self._download_hndlr(self.cl.reels)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: warp_beacon
3
- Version: 2.3.1
3
+ Version: 2.3.3
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
@@ -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=d8xsJ2T7T4QeQAnN5wVA8skG3vnUUxDhMK7Uqg1maGI,23
7
+ warp_beacon/__version__.py,sha256=bvpl3gRk00I2k9olo-PnBLwWTETbsDRFdzU2ukT6Z20,23
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
@@ -16,18 +16,18 @@ warp_beacon/jobs/upload_job.py,sha256=_ul4psPej1jLEs-BMcMR80GbXDSmm38jE9yoZteccl
16
16
  warp_beacon/mediainfo/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
17
  warp_beacon/mediainfo/abstract.py,sha256=ZR2JMuRpoh7nDNov9a8YkAfr6BI2HXnXzQtVrLgDxjs,1185
18
18
  warp_beacon/mediainfo/audio.py,sha256=ous88kwQj4bDIChN5wnGil5LqTs0IQHH0d-nyrL0-ZM,651
19
- warp_beacon/mediainfo/silencer.py,sha256=MgUc9Ibbhjhg9GbJMNfJqrdDkMsQShZkQ1sCwvW_-qI,1647
19
+ warp_beacon/mediainfo/silencer.py,sha256=qxMuViOoVwUYb60uCVvqHiGrqByR1_4_rqMT-XdMkwc,1813
20
20
  warp_beacon/mediainfo/video.py,sha256=UBZrhTN5IDI-aYu6tsJEILo9nFkjHhkldGVFmvV7tEI,2480
21
21
  warp_beacon/scheduler/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
22
  warp_beacon/scheduler/scheduler.py,sha256=F9jF6myIHOI0TmC0-rBt2Un8gVvuhBW9zL-nEAEj0Bc,2585
23
23
  warp_beacon/scraper/__init__.py,sha256=V_C5SmAmRtjFfVBtTotOHCW3ILMQ8m_ulrBF6ry59_A,16944
24
24
  warp_beacon/scraper/abstract.py,sha256=6A6KuBUHZhu8VAyBwLgmnxMPHJcLpgwLapmULy8hpoA,2726
25
- warp_beacon/scraper/account_selector.py,sha256=_4x28QeSSc27bOpWab8vLdmJNKk3DF66A3GHCaqxJWU,4237
25
+ warp_beacon/scraper/account_selector.py,sha256=WLG1gHYgusnCdas_khzHg2vcwHHGEWlm6Vvl2l_4IpU,4436
26
26
  warp_beacon/scraper/exceptions.py,sha256=Qkz76yo-X5kucEZIP9tWaK-oYO-kvsPEl8Y0W63oDhU,1300
27
27
  warp_beacon/scraper/fail_handler.py,sha256=_blvckfTZ4xWVancQKVRXH5ClKGwfrBxMwvXIFZh1qA,975
28
28
  warp_beacon/scraper/link_resolver.py,sha256=Rc9ZuMyOo3iPywDHwjngy-WRQ2SXhJwxcg-5ripx7tM,2447
29
29
  warp_beacon/scraper/instagram/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
30
- warp_beacon/scraper/instagram/instagram.py,sha256=_0GeWXP4m1hKkbjmo771t67w8rrr0u2CuLJtgecp6c8,13180
30
+ warp_beacon/scraper/instagram/instagram.py,sha256=b10mk8IGX9vDKcMVrCXvcELUSEmwOLUJJVKOuFTQSa8,13592
31
31
  warp_beacon/scraper/youtube/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
32
32
  warp_beacon/scraper/youtube/abstract.py,sha256=cBtExei2Cb3o4YBtHqi8If_FdmE6NyJqNKacm5aw7S0,9243
33
33
  warp_beacon/scraper/youtube/music.py,sha256=qbijpSv54fsrIYHeY-nfmw4vo6oBmedQHsVG8pXNfrc,1380
@@ -41,9 +41,9 @@ warp_beacon/telegram/handlers.py,sha256=sefkG9jU85m4oMxkJ8WqA4aiJLLBv98OIgYxY49c
41
41
  warp_beacon/telegram/placeholder_message.py,sha256=wN9-BRiyrtHG-EvXtZkGJHt2CX71munQ57ITttjt0mw,6400
42
42
  warp_beacon/telegram/utils.py,sha256=6oEOEzyN9fAmUZVbk5sjFyHcsPrrb2IlI3zXnRCwjHU,2403
43
43
  warp_beacon/uploader/__init__.py,sha256=5KRWsxPRGuQ56YhCEnJsXnb-yQp8dpvWEsPDf0dD-fw,4964
44
- warp_beacon-2.3.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
45
- warp_beacon-2.3.1.dist-info/METADATA,sha256=Kn998t53Rwdu-CEesyoR2YA7Ub-orjjdefPMv3lzD3o,21703
46
- warp_beacon-2.3.1.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
47
- warp_beacon-2.3.1.dist-info/entry_points.txt,sha256=eSB61Rb89d56WY0O-vEIQwkn18J-4CMrJcLA_R_8h3g,119
48
- warp_beacon-2.3.1.dist-info/top_level.txt,sha256=XusFB1mGUStI2gqbtRuJzQrfrAXmdMaT3QTyfvdLEXI,1064
49
- warp_beacon-2.3.1.dist-info/RECORD,,
44
+ warp_beacon-2.3.3.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
45
+ warp_beacon-2.3.3.dist-info/METADATA,sha256=Puw-S90eCUcZvPRFvCWtZAwu3i8t6_wXVNYj0YCYZzw,21703
46
+ warp_beacon-2.3.3.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
47
+ warp_beacon-2.3.3.dist-info/entry_points.txt,sha256=eSB61Rb89d56WY0O-vEIQwkn18J-4CMrJcLA_R_8h3g,119
48
+ warp_beacon-2.3.3.dist-info/top_level.txt,sha256=XusFB1mGUStI2gqbtRuJzQrfrAXmdMaT3QTyfvdLEXI,1064
49
+ warp_beacon-2.3.3.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.2)
2
+ Generator: setuptools (76.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5