warp-beacon 2.2.59__py3-none-any.whl → 2.2.61__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.2.59"
1
+ __version__ = "2.2.61"
2
2
 
@@ -75,7 +75,7 @@ class Handlers(object):
75
75
  for url in urls:
76
76
  origin = Utils.extract_origin(url)
77
77
  if origin is Origin.INSTAGRAM:
78
- url = Utils.convert_ig_share_link(url)
78
+ url = Utils.resolve_ig_share_link(url)
79
79
  if origin is Origin.YOUTU_BE:
80
80
  url = Utils.extract_youtu_be_link(url)
81
81
  if not url:
@@ -2,7 +2,6 @@ from typing import Union
2
2
 
3
3
  import re
4
4
  import requests
5
- from urllib.parse import urlparse
6
5
 
7
6
  from pyrogram.types import Message
8
7
 
@@ -13,6 +12,7 @@ import logging
13
12
 
14
13
  class Utils(object):
15
14
  expected_patronum_compiled_re = re.compile(r'Expected ([A-Z]+), got ([A-Z]+) file id instead')
15
+ canonical_link_resolve_re = re.compile(r'<link.*rel="canonical".*href="([^"]+)"\s*/?>')
16
16
 
17
17
  @staticmethod
18
18
  def extract_file_id(message: Message) -> Union[None, str]:
@@ -60,13 +60,14 @@ class Utils(object):
60
60
  return ''
61
61
 
62
62
  @staticmethod
63
- def convert_ig_share_link(url: str) -> str:
63
+ def resolve_ig_share_link(url: str) -> str:
64
64
  # expected url: https://www.instagram.com/share/reel/BAHtk2AamB
65
65
  # result url: https://www.instagram.com/reel/DAKjQgUNzuH/
66
66
  try:
67
67
  if "instagram.com/" in url and "share" in url and "reel" in url:
68
- reel_id = urlparse(url).path.split[-1]
69
- new_url = f'https://www.instagram.com/reel/{reel_id}/'
68
+ content = requests.get(url).text
69
+ res = re.search(Utils.canonical_link_resolve_re, content)
70
+ new_url = res.group(1).strip()
70
71
  logging.info("Converted IG share link to '%s'", new_url)
71
72
  return new_url
72
73
  except Exception as e:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: warp_beacon
3
- Version: 2.2.59
3
+ Version: 2.2.61
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
@@ -3,7 +3,7 @@ lib/systemd/system/warp_beacon.service,sha256=lPmHqLqcI2eIV7nwHS0qcALQrznixqJuww
3
3
  var/warp_beacon/accounts.json,sha256=2QQMS9N_Z-TnfZq4U1vSUe4IKyZGmTFdgo8BoF4hQ7E,1710
4
4
  var/warp_beacon/placeholder.gif,sha256=cE5CGJVaop4Sx21zx6j4AyoHU0ncmvQuS2o6hJfEH88,6064
5
5
  warp_beacon/__init__.py,sha256=_rThNODmz0nDp_n4mWo_HKaNFE5jk1_7cRhHyYaencI,163
6
- warp_beacon/__version__.py,sha256=3gIF5ZiSoycCD0uaK8jM1O1THJi-NB2FPt8jZyxZf4o,24
6
+ warp_beacon/__version__.py,sha256=wcZKZSn0EEEdLlfM6XEv4Q6KlYXZUlSTCl-qNNK5EVk,24
7
7
  warp_beacon/warp_beacon.py,sha256=7KEtZDj-pdhtl6m-zFLsSojs1ZR4o7L0xbqtdmYPvfE,342
8
8
  warp_beacon/compress/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  warp_beacon/compress/video.py,sha256=_PDMVYCyzLYxHv1uZmmzGcG_8rjaZr7BTXsXTTy_oS4,2846
@@ -33,13 +33,13 @@ warp_beacon/scraper/youtube/youtube.py,sha256=JvN5pVz0jtxCY9FGMl1dIg5Ccr2Kulaoxt
33
33
  warp_beacon/storage/__init__.py,sha256=m86MDXBMtZZsTPLI2cD-pM5Xkh2g2NYVvp_dtW8eH0Q,3548
34
34
  warp_beacon/telegram/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
35
  warp_beacon/telegram/bot.py,sha256=MONqsxLMJk3jnLFpn1Nfj5w-FSxPNS2Fx9QfaK2S5lw,15446
36
- warp_beacon/telegram/handlers.py,sha256=3VgD719pgJqu46zatL_0M_KzuoIUkW7FYMyLjb0YzaM,7262
36
+ warp_beacon/telegram/handlers.py,sha256=171BUNjcaqTM1QnJ9KTBzuJOX1tiDys0hnyuAkA1NiI,7262
37
37
  warp_beacon/telegram/placeholder_message.py,sha256=N1fSL1xbFLF5alhnEvk-xbf3v2A_nLWg6xHtVZTaoiA,6396
38
- warp_beacon/telegram/utils.py,sha256=9wm8wy4q99FX5cDfiKs_Yrst5aD0pNTDCX0Y-mBy558,3045
38
+ warp_beacon/telegram/utils.py,sha256=5BlpPAVZ4rEf0qk3m-Tl5510GumnY070VypugXUtoL0,3132
39
39
  warp_beacon/uploader/__init__.py,sha256=rbfsm_eYcfsBRkiaG0glVgBNtQCEe7cVQTWEIAHz5aw,4763
40
- warp_beacon-2.2.59.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
41
- warp_beacon-2.2.59.dist-info/METADATA,sha256=1zUJdv19810AjGJUrGjXkfMdh5sZJV0ML_I58nfX_9k,21303
42
- warp_beacon-2.2.59.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
43
- warp_beacon-2.2.59.dist-info/entry_points.txt,sha256=eSB61Rb89d56WY0O-vEIQwkn18J-4CMrJcLA_R_8h3g,119
44
- warp_beacon-2.2.59.dist-info/top_level.txt,sha256=ALb_Ft_eG-OY4_m0TWUifNUOZsrx483L-zw7G7vqXoc,971
45
- warp_beacon-2.2.59.dist-info/RECORD,,
40
+ warp_beacon-2.2.61.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
41
+ warp_beacon-2.2.61.dist-info/METADATA,sha256=_VoEClGxi4ctYuKJtumI8OX9JCvjccprq-NOlsHSZVQ,21303
42
+ warp_beacon-2.2.61.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
43
+ warp_beacon-2.2.61.dist-info/entry_points.txt,sha256=eSB61Rb89d56WY0O-vEIQwkn18J-4CMrJcLA_R_8h3g,119
44
+ warp_beacon-2.2.61.dist-info/top_level.txt,sha256=ALb_Ft_eG-OY4_m0TWUifNUOZsrx483L-zw7G7vqXoc,971
45
+ warp_beacon-2.2.61.dist-info/RECORD,,