warp-beacon 2.6.80__tar.gz → 2.6.82__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 (69) hide show
  1. {warp_beacon-2.6.80/warp_beacon.egg-info → warp_beacon-2.6.82}/PKG-INFO +1 -1
  2. warp_beacon-2.6.82/warp_beacon/__version__.py +2 -0
  3. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/scraper/instagram/wb_instagrapi.py +53 -4
  4. {warp_beacon-2.6.80 → warp_beacon-2.6.82/warp_beacon.egg-info}/PKG-INFO +1 -1
  5. warp_beacon-2.6.80/warp_beacon/__version__.py +0 -2
  6. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/LICENSE +0 -0
  7. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/MANIFEST.in +0 -0
  8. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/README.md +0 -0
  9. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/assets/placeholder.gif +0 -0
  10. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/etc/.gitignore +0 -0
  11. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/etc/accounts.json +0 -0
  12. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/etc/proxies.json +0 -0
  13. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/etc/warp_beacon.conf +0 -0
  14. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/etc/warp_beacon.service +0 -0
  15. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/pyproject.toml +0 -0
  16. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/setup.cfg +0 -0
  17. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/setup.py +0 -0
  18. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/__init__.py +0 -0
  19. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/compress/__init__.py +0 -0
  20. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/compress/video.py +0 -0
  21. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/jobs/__init__.py +0 -0
  22. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/jobs/abstract.py +0 -0
  23. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/jobs/download_job.py +0 -0
  24. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/jobs/types.py +0 -0
  25. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/jobs/upload_job.py +0 -0
  26. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/mediainfo/__init__.py +0 -0
  27. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/mediainfo/abstract.py +0 -0
  28. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/mediainfo/audio.py +0 -0
  29. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/mediainfo/silencer.py +0 -0
  30. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/mediainfo/video.py +0 -0
  31. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/scheduler/__init__.py +0 -0
  32. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/scheduler/instagram_human.py +0 -0
  33. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/scheduler/scheduler.py +0 -0
  34. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/scraper/__init__.py +0 -0
  35. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/scraper/abstract.py +0 -0
  36. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/scraper/account_selector.py +0 -0
  37. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/scraper/exceptions.py +0 -0
  38. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/scraper/fail_handler.py +0 -0
  39. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/scraper/instagram/__init__.py +0 -0
  40. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/scraper/instagram/captcha.py +0 -0
  41. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/scraper/instagram/instagram.py +0 -0
  42. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/scraper/link_resolver.py +0 -0
  43. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/scraper/utils.py +0 -0
  44. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/scraper/youtube/__init__.py +0 -0
  45. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/scraper/youtube/abstract.py +0 -0
  46. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/scraper/youtube/music.py +0 -0
  47. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/scraper/youtube/shorts.py +0 -0
  48. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/scraper/youtube/youtube.py +0 -0
  49. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/storage/__init__.py +0 -0
  50. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/storage/mongo.py +0 -0
  51. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/telegram/__init__.py +0 -0
  52. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/telegram/bot.py +0 -0
  53. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/telegram/caption_shortener.py +0 -0
  54. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/telegram/download_status.py +0 -0
  55. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/telegram/edit_message.py +0 -0
  56. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/telegram/handlers.py +0 -0
  57. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/telegram/placeholder_message.py +0 -0
  58. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/telegram/progress_bar.py +0 -0
  59. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/telegram/progress_file_reader.py +0 -0
  60. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/telegram/types.py +0 -0
  61. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/telegram/utils.py +0 -0
  62. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/uploader/__init__.py +0 -0
  63. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/warp_beacon.py +0 -0
  64. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon/yt_auth.py +0 -0
  65. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon.egg-info/SOURCES.txt +0 -0
  66. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon.egg-info/dependency_links.txt +0 -0
  67. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon.egg-info/entry_points.txt +0 -0
  68. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon.egg-info/requires.txt +0 -0
  69. {warp_beacon-2.6.80 → warp_beacon-2.6.82}/warp_beacon.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: warp_beacon
3
- Version: 2.6.80
3
+ Version: 2.6.82
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.6.82"
2
+
@@ -1,6 +1,6 @@
1
1
  import logging
2
2
  from typing import Callable
3
- from urllib.parse import urlparse
3
+ from urllib.parse import urlparse, parse_qs, urlencode, urlunparse
4
4
  from pathlib import Path
5
5
  import requests
6
6
 
@@ -14,20 +14,59 @@ class WBClient(Client):
14
14
  def __init__(self) -> None:
15
15
  super().__init__()
16
16
  self.progress_callback = None
17
+ self.session = requests.Session()
18
+ # may be I should remove '"Sec-Fetch-*", "Upgrade-Insecure-Requests", "DNT"' ?
19
+ self.session.headers.update({
20
+ "User-Agent": (
21
+ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 "
22
+ "(KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36"
23
+ ),
24
+ "Accept": (
25
+ "text/html,application/xhtml+xml,application/xml;"
26
+ "q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8"
27
+ ),
28
+ "Accept-Language": "en-US,en;q=0.9",
29
+ "Accept-Encoding": "gzip, deflate, br",
30
+ "Referer": "https://www.instagram.com/",
31
+ "Connection": "keep-alive",
32
+ "Sec-Fetch-Site": "same-origin",
33
+ "Sec-Fetch-Mode": "navigate",
34
+ "Sec-Fetch-User": "?1",
35
+ "Sec-Fetch-Dest": "document",
36
+ "Upgrade-Insecure-Requests": "1",
37
+ "DNT": "1",
38
+ })
39
+ self.essential_params = {"oe", "oh", "_nc_ht", "_nc_cat", "_nc_oc", "_nc_ohc", "_nc_gid"}
17
40
 
18
41
  def set_progress_callback(self, callback: Callable[[int | None, int, Path], None]) -> None:
19
42
  if not callback or not callable(callback):
20
43
  raise TypeError("Progress callback must be callable")
21
44
  self.progress_callback = callback
22
45
 
46
+ def sanitize_instagram_url(self, url: str) -> str:
47
+ parsed = urlparse(url)
48
+ query = parse_qs(parsed.query)
49
+ filtered_query = {k: v for k, v in query.items() if k in self.essential_params}
50
+ new_query = urlencode(filtered_query, doseq=True)
51
+ return urlunparse(parsed._replace(query=new_query))
52
+
23
53
  def video_download_by_url(self, url: str, filename: str = "", folder: Path = "") -> Path:
54
+ url = self.sanitize_instagram_url(url)
24
55
  fname = urlparse(url).path.rsplit("/", 1)[1]
25
56
  filename = f"{filename}.{fname.rsplit('.', 1)[1]}" if filename else fname
26
57
  path = Path(folder or Path.cwd()) / filename
27
58
 
28
59
  logging.info("Downloading video from '%s' to '%s'", url, path)
29
60
 
30
- response = requests.get(url, stream=True, timeout=self.request_timeout)
61
+ prepared = self.session.prepare_request(requests.Request("GET", url))
62
+ logging.info("Prepared headers: %s", prepared.headers)
63
+ response = self.session.send(
64
+ prepared,
65
+ stream=True,
66
+ verify=False,
67
+ proxies=self.public.proxies,
68
+ timeout=self.request_timeout
69
+ )
31
70
  response.raise_for_status()
32
71
  logging.info("Response headers: %s", response.headers)
33
72
 
@@ -64,13 +103,23 @@ class WBClient(Client):
64
103
  def photo_download_by_url(
65
104
  self, url: str, filename: str = "", folder: Path = ""
66
105
  ) -> Path:
106
+ url = self.sanitize_instagram_url(url)
67
107
  fname = urlparse(url).path.rsplit("/", 1)[1]
68
108
  filename = f"{filename}.{(filename, fname.rsplit('.', 1)[1]) if filename else fname}"
69
109
  path = Path(folder) / filename
70
110
 
71
111
  logging.info("Downloading photo from '%s' to '%s'", url, path)
72
-
73
- response = requests.get(url, stream=True, timeout=self.request_timeout)
112
+ logging.info("[Downloader] Using proxies: %s", self.public.proxies)
113
+
114
+ prepared = self.session.prepare_request(requests.Request("GET", url))
115
+ logging.info("Prepared headers: %s", prepared.headers)
116
+ response = self.session.send(
117
+ prepared,
118
+ stream=True,
119
+ verify=False,
120
+ proxies=self.public.proxies,
121
+ timeout=self.request_timeout
122
+ )
74
123
  response.raise_for_status()
75
124
  logging.info("Response headers: %s", response.headers)
76
125
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: warp_beacon
3
- Version: 2.6.80
3
+ Version: 2.6.82
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.6.80"
2
-
File without changes
File without changes
File without changes
File without changes
File without changes