warp-beacon 2.8.4__py3-none-any.whl → 2.8.6__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/X/X.py +30 -6
- {warp_beacon-2.8.4.dist-info → warp_beacon-2.8.6.dist-info}/METADATA +1 -1
- {warp_beacon-2.8.4.dist-info → warp_beacon-2.8.6.dist-info}/RECORD +8 -8
- {warp_beacon-2.8.4.dist-info → warp_beacon-2.8.6.dist-info}/WHEEL +0 -0
- {warp_beacon-2.8.4.dist-info → warp_beacon-2.8.6.dist-info}/entry_points.txt +0 -0
- {warp_beacon-2.8.4.dist-info → warp_beacon-2.8.6.dist-info}/licenses/LICENSE +0 -0
- {warp_beacon-2.8.4.dist-info → warp_beacon-2.8.6.dist-info}/top_level.txt +0 -0
warp_beacon/__version__.py
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
__version__ = "2.8.
|
1
|
+
__version__ = "2.8.6"
|
2
2
|
|
warp_beacon/scraper/X/X.py
CHANGED
@@ -5,7 +5,7 @@ from mimetypes import guess_extension
|
|
5
5
|
from urllib.parse import urlparse
|
6
6
|
import requests
|
7
7
|
import yt_dlp
|
8
|
-
from playwright.sync_api import sync_playwright
|
8
|
+
from playwright.sync_api import sync_playwright, Page
|
9
9
|
|
10
10
|
from warp_beacon.telegram.utils import Utils
|
11
11
|
from warp_beacon.scraper.utils import ScraperUtils
|
@@ -200,7 +200,34 @@ class XScraper(XAbstract):
|
|
200
200
|
downloaded_imgs.append(filepath)
|
201
201
|
|
202
202
|
return downloaded_imgs, post_text
|
203
|
-
|
203
|
+
|
204
|
+
def extract_post_text(self, page: Page) -> str:
|
205
|
+
try:
|
206
|
+
tweet_texts = []
|
207
|
+
# collecting text blocks from post
|
208
|
+
containers = page.query_selector_all('div[data-testid="tweetText"]')
|
209
|
+
for container in containers:
|
210
|
+
try:
|
211
|
+
spans = container.query_selector_all("span")
|
212
|
+
if spans:
|
213
|
+
for span in spans:
|
214
|
+
text = span.inner_text().strip()
|
215
|
+
if text:
|
216
|
+
tweet_texts.append(text)
|
217
|
+
else:
|
218
|
+
# to span's try container itself
|
219
|
+
text = container.inner_text().strip()
|
220
|
+
if text:
|
221
|
+
tweet_texts.append(text)
|
222
|
+
except Exception:
|
223
|
+
continue
|
224
|
+
|
225
|
+
return " ".join(tweet_texts).strip()
|
226
|
+
except Exception as e:
|
227
|
+
logging.warning("Failed to extract tweet text.", exc_info=e)
|
228
|
+
|
229
|
+
return ""
|
230
|
+
|
204
231
|
def extract_image_urls_from_x_post(self, url: str, timeout: int = 60) -> tuple[list[str], str]:
|
205
232
|
img_urls, post_text = [], ''
|
206
233
|
|
@@ -224,9 +251,7 @@ class XScraper(XAbstract):
|
|
224
251
|
|
225
252
|
#page.wait_for_timeout(3000)
|
226
253
|
page.wait_for_selector("img[src*='pbs.twimg.com/media']", timeout=(timeout*1000))
|
227
|
-
|
228
|
-
if text_element:
|
229
|
-
text = text_element.inner_text()
|
254
|
+
post_text = self.extract_post_text(page)
|
230
255
|
|
231
256
|
image_elements = page.query_selector_all("img")
|
232
257
|
image_urls = []
|
@@ -237,5 +262,4 @@ class XScraper(XAbstract):
|
|
237
262
|
image_urls.append(src)
|
238
263
|
|
239
264
|
img_urls = list(set(image_urls))
|
240
|
-
post_text = str(text)
|
241
265
|
return img_urls, post_text
|
@@ -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=Hm_e9QMByvoNNxgb1GLg8_JIDnCEz-Y05F0A2SJvVNM,23
|
8
8
|
warp_beacon/warp_beacon.py,sha256=ADCR30uGXIsDrt9WoiI9Ghu2QtWs0qZIK6x3pQKM_B4,1109
|
9
9
|
warp_beacon/yt_auth.py,sha256=GUTKqYr_tzDC-07Lx_ahWXSag8EyLxXBUnQbDBIkEmk,6022
|
10
10
|
warp_beacon/compress/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -29,7 +29,7 @@ warp_beacon/scraper/exceptions.py,sha256=EKwoF0oH2xZWbNU-v8DOaWK5skKwa3s1yTIBdlc
|
|
29
29
|
warp_beacon/scraper/fail_handler.py,sha256=5ODu4b8ndZWAcHIXrcUufsWFihetzNUoAi8IgAkreyQ,998
|
30
30
|
warp_beacon/scraper/link_resolver.py,sha256=Rc9ZuMyOo3iPywDHwjngy-WRQ2SXhJwxcg-5ripx7tM,2447
|
31
31
|
warp_beacon/scraper/utils.py,sha256=AOZmDki2Pbr84IG-j_wN2UghKCiWFVDYdx6HJl0JTBs,1258
|
32
|
-
warp_beacon/scraper/X/X.py,sha256=
|
32
|
+
warp_beacon/scraper/X/X.py,sha256=N9-nbqBv2aNNEUd-QtZa-sBsCog-wek85Zdw1i0Q_lM,7907
|
33
33
|
warp_beacon/scraper/X/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
34
34
|
warp_beacon/scraper/X/abstract.py,sha256=pCzZPTCtn8pRbBx2SeuBUpMkEHqnOLtwLBAHYceL12Q,5475
|
35
35
|
warp_beacon/scraper/X/types.py,sha256=i36Nu2cHpHCkvoeobBQC3B13Ke_N40tgCCApcm_FBFY,76
|
@@ -56,9 +56,9 @@ warp_beacon/telegram/progress_file_reader.py,sha256=e3equyNKlKs764AD-iE9QRsh3YDH
|
|
56
56
|
warp_beacon/telegram/types.py,sha256=Kvdng6uCF1HRoqQgGW1ZYYPJoVuYkFb-LDvMBbW5Hjk,89
|
57
57
|
warp_beacon/telegram/utils.py,sha256=zTF8VQfAWetBSjAPbmNe_Zi_LN5fAcWptJKjLaFNHaE,5073
|
58
58
|
warp_beacon/uploader/__init__.py,sha256=1enK6qMWaTZEaK456JwaKOfvCvznHA8cjgceOsrF6Po,5732
|
59
|
-
warp_beacon-2.8.
|
60
|
-
warp_beacon-2.8.
|
61
|
-
warp_beacon-2.8.
|
62
|
-
warp_beacon-2.8.
|
63
|
-
warp_beacon-2.8.
|
64
|
-
warp_beacon-2.8.
|
59
|
+
warp_beacon-2.8.6.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
60
|
+
warp_beacon-2.8.6.dist-info/METADATA,sha256=8MtpB3yYJK75N8q1spUukoa6qbeBImLIPhDsxalL8YQ,23214
|
61
|
+
warp_beacon-2.8.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
62
|
+
warp_beacon-2.8.6.dist-info/entry_points.txt,sha256=eSB61Rb89d56WY0O-vEIQwkn18J-4CMrJcLA_R_8h3g,119
|
63
|
+
warp_beacon-2.8.6.dist-info/top_level.txt,sha256=RraB0PWGvRK2zPYkuICKNgStLG1C5s7rPHHJEHJbkgA,1510
|
64
|
+
warp_beacon-2.8.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|