Rubka 6.6.8__tar.gz → 6.6.10__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. {rubka-6.6.8 → rubka-6.6.10}/PKG-INFO +1 -1
  2. {rubka-6.6.8 → rubka-6.6.10}/Rubka.egg-info/PKG-INFO +1 -1
  3. {rubka-6.6.8 → rubka-6.6.10}/Rubka.egg-info/SOURCES.txt +1 -0
  4. {rubka-6.6.8 → rubka-6.6.10}/rubka/__init__.py +1 -0
  5. rubka-6.6.10/rubka/tv.py +137 -0
  6. {rubka-6.6.8 → rubka-6.6.10}/setup.py +1 -1
  7. {rubka-6.6.8 → rubka-6.6.10}/README.md +0 -0
  8. {rubka-6.6.8 → rubka-6.6.10}/Rubka.egg-info/dependency_links.txt +0 -0
  9. {rubka-6.6.8 → rubka-6.6.10}/Rubka.egg-info/entry_points.txt +0 -0
  10. {rubka-6.6.8 → rubka-6.6.10}/Rubka.egg-info/not-zip-safe +0 -0
  11. {rubka-6.6.8 → rubka-6.6.10}/Rubka.egg-info/requires.txt +0 -0
  12. {rubka-6.6.8 → rubka-6.6.10}/Rubka.egg-info/top_level.txt +0 -0
  13. {rubka-6.6.8 → rubka-6.6.10}/rubka/adaptorrubka/__init__.py +0 -0
  14. {rubka-6.6.8 → rubka-6.6.10}/rubka/adaptorrubka/client/__init__.py +0 -0
  15. {rubka-6.6.8 → rubka-6.6.10}/rubka/adaptorrubka/client/client.py +0 -0
  16. {rubka-6.6.8 → rubka-6.6.10}/rubka/adaptorrubka/crypto/__init__.py +0 -0
  17. {rubka-6.6.8 → rubka-6.6.10}/rubka/adaptorrubka/crypto/crypto.py +0 -0
  18. {rubka-6.6.8 → rubka-6.6.10}/rubka/adaptorrubka/enums.py +0 -0
  19. {rubka-6.6.8 → rubka-6.6.10}/rubka/adaptorrubka/exceptions.py +0 -0
  20. {rubka-6.6.8 → rubka-6.6.10}/rubka/adaptorrubka/methods/__init__.py +0 -0
  21. {rubka-6.6.8 → rubka-6.6.10}/rubka/adaptorrubka/methods/methods.py +0 -0
  22. {rubka-6.6.8 → rubka-6.6.10}/rubka/adaptorrubka/network/__init__.py +0 -0
  23. {rubka-6.6.8 → rubka-6.6.10}/rubka/adaptorrubka/network/helper.py +0 -0
  24. {rubka-6.6.8 → rubka-6.6.10}/rubka/adaptorrubka/network/network.py +0 -0
  25. {rubka-6.6.8 → rubka-6.6.10}/rubka/adaptorrubka/network/socket.py +0 -0
  26. {rubka-6.6.8 → rubka-6.6.10}/rubka/adaptorrubka/sessions/__init__.py +0 -0
  27. {rubka-6.6.8 → rubka-6.6.10}/rubka/adaptorrubka/sessions/sessions.py +0 -0
  28. {rubka-6.6.8 → rubka-6.6.10}/rubka/adaptorrubka/types/__init__.py +0 -0
  29. {rubka-6.6.8 → rubka-6.6.10}/rubka/adaptorrubka/types/socket/__init__.py +0 -0
  30. {rubka-6.6.8 → rubka-6.6.10}/rubka/adaptorrubka/types/socket/message.py +0 -0
  31. {rubka-6.6.8 → rubka-6.6.10}/rubka/adaptorrubka/utils/__init__.py +0 -0
  32. {rubka-6.6.8 → rubka-6.6.10}/rubka/adaptorrubka/utils/configs.py +0 -0
  33. {rubka-6.6.8 → rubka-6.6.10}/rubka/adaptorrubka/utils/utils.py +0 -0
  34. {rubka-6.6.8 → rubka-6.6.10}/rubka/api.py +0 -0
  35. {rubka-6.6.8 → rubka-6.6.10}/rubka/asynco.py +0 -0
  36. {rubka-6.6.8 → rubka-6.6.10}/rubka/button.py +0 -0
  37. {rubka-6.6.8 → rubka-6.6.10}/rubka/config.py +0 -0
  38. {rubka-6.6.8 → rubka-6.6.10}/rubka/context.py +0 -0
  39. {rubka-6.6.8 → rubka-6.6.10}/rubka/decorators.py +0 -0
  40. {rubka-6.6.8 → rubka-6.6.10}/rubka/exceptions.py +0 -0
  41. {rubka-6.6.8 → rubka-6.6.10}/rubka/filters.py +0 -0
  42. {rubka-6.6.8 → rubka-6.6.10}/rubka/helpers.py +0 -0
  43. {rubka-6.6.8 → rubka-6.6.10}/rubka/jobs.py +0 -0
  44. {rubka-6.6.8 → rubka-6.6.10}/rubka/keyboards.py +0 -0
  45. {rubka-6.6.8 → rubka-6.6.10}/rubka/keypad.py +0 -0
  46. {rubka-6.6.8 → rubka-6.6.10}/rubka/logger.py +0 -0
  47. {rubka-6.6.8 → rubka-6.6.10}/rubka/rubino.py +0 -0
  48. {rubka-6.6.8 → rubka-6.6.10}/rubka/update.py +0 -0
  49. {rubka-6.6.8 → rubka-6.6.10}/rubka/utils.py +0 -0
  50. {rubka-6.6.8 → rubka-6.6.10}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Rubka
3
- Version: 6.6.8
3
+ Version: 6.6.10
4
4
  Summary: rubika A Python library for interacting with Rubika Bot API.
5
5
  Home-page: https://github.com/Mahdy-Ahmadi/Rubka
6
6
  Download-URL: https://github.com/Mahdy-Ahmadi/rubka/archive/refs/tags/v6.6.4.zip
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Rubka
3
- Version: 6.6.8
3
+ Version: 6.6.10
4
4
  Summary: rubika A Python library for interacting with Rubika Bot API.
5
5
  Home-page: https://github.com/Mahdy-Ahmadi/Rubka
6
6
  Download-URL: https://github.com/Mahdy-Ahmadi/rubka/archive/refs/tags/v6.6.4.zip
@@ -22,6 +22,7 @@ rubka/keyboards.py
22
22
  rubka/keypad.py
23
23
  rubka/logger.py
24
24
  rubka/rubino.py
25
+ rubka/tv.py
25
26
  rubka/update.py
26
27
  rubka/utils.py
27
28
  rubka/adaptorrubka/__init__.py
@@ -70,6 +70,7 @@ from .api import Robot
70
70
  from .rubino import Bot
71
71
  from .exceptions import APIRequestError
72
72
  from .rubino import Bot as rubino
73
+ from .tv import TV as Client
73
74
 
74
75
  __all__ = [
75
76
  "Robot",
@@ -0,0 +1,137 @@
1
+ import asyncio
2
+ import random
3
+ from typing import Optional, Dict, Any
4
+
5
+ import httpx
6
+
7
+ class TV:
8
+ BASE_URL_TEMPLATE = "https://rbvod{}.iranlms.ir/"
9
+ META_URL = "https://tv.rubika.ir/meta.json"
10
+
11
+ DEFAULT_HEADERS = {
12
+ 'accept': '*/*',
13
+ 'accept-encoding': 'gzip, deflate, br, zstd',
14
+ 'accept-language': 'fa',
15
+ 'content-type': 'application/json;charset=UTF-8',
16
+ 'origin': 'https://tv.rubika.ir',
17
+ 'referer': 'https://tv.rubika.ir/',
18
+ 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36'
19
+ }
20
+
21
+ def __init__(
22
+ self,
23
+ auth: str,
24
+ proxy: Optional[str] = None,
25
+ headers: Optional[Dict[str, str]] = None
26
+ ) -> None:
27
+ """
28
+ - auth: توکن احراز هویت حساب کاربری
29
+ - proxy: پراکسی برای ارسال درخواست‌ها (اختیاری)
30
+ - headers: هدرهای سفارشی برای ارسال درخواست‌ها (اختیاری)
31
+ """
32
+ self.auth = auth
33
+ self.headers = headers if headers is not None else self.DEFAULT_HEADERS
34
+ self._version: Optional[str] = None
35
+ self.client = httpx.AsyncClient(
36
+ headers=self.headers,
37
+ proxies=proxy,
38
+ timeout=15.0,
39
+ http2=True
40
+ )
41
+
42
+ async def _get_version(self) -> str:
43
+ if self._version is None:
44
+ try:
45
+ response = await self.client.get(self.META_URL)
46
+ response.raise_for_status()
47
+ self._version = response.json()['version']
48
+ except httpx.RequestError:
49
+ self._version = "3.2.3"
50
+ return self._version
51
+
52
+ def _get_request_url(self) -> str:
53
+ return self.BASE_URL_TEMPLATE.format(random.randint(1, 4))
54
+
55
+ async def _request_post(self, method: str, data: Dict[str, Any]) -> Dict[str, Any]:
56
+ payload = {
57
+ "auth": self.auth,
58
+ "api_version": "1",
59
+ "client": {
60
+ "app_name": "Main",
61
+ "app_version": await self._get_version(),
62
+ "package": "tv.rubika.ir",
63
+ "platform": "TVWeb",
64
+ "lang_code": "fa"
65
+ },
66
+ "data": data,
67
+ "method": method
68
+ }
69
+
70
+ try:
71
+ response = await self.client.post(self._get_request_url(), json=payload)
72
+ response.raise_for_status()
73
+ response_data = response.json()
74
+
75
+ if 'data' in response_data:
76
+ return response_data['data']
77
+ elif 'status_det' in response_data:
78
+ return {'status_detail': response_data['status_det']}
79
+ raise ValueError("پاسخ نامعتبر از سرور دریافت شد.")
80
+
81
+ except httpx.RequestError as e:
82
+
83
+ raise ConnectionError(f"خطا در ارتباط با سرور: {e}") from e
84
+
85
+
86
+
87
+
88
+ async def get_list_items(self, list_id: str, type: str = "Media", start_id: str = "0"):
89
+ return await self._request_post("getListItems", {"list_id": list_id, "type": type, "start_id": start_id})
90
+
91
+ async def get_media_by_id(self, media_id: str,track_id:str=None):
92
+ return await self._request_post("getMedia", {"media_id": media_id,"track_id":track_id})
93
+
94
+ async def get_custom_menu_items(self):
95
+ return await self._request_post("getCustomMenuItems", {})
96
+
97
+ async def get_wish_list(self, start_id: Optional[str] = None):
98
+ return await self._request_post("getWishList", {"start_id": start_id})
99
+
100
+ async def get_me(self):
101
+ return await self._request_post("getAccountInfo", {})
102
+
103
+ async def search_video(self, text: str, start_id: Optional[str] = None):
104
+ return await self._request_post("search", {'search_text': text, 'start_id': start_id})
105
+
106
+ async def _action_on_media(self, action: str, media_id: str):
107
+
108
+ return await self._request_post('actionOnMedia', {'action': action, 'media_id': media_id})
109
+
110
+ async def like_media(self, media_id: str):
111
+ return await self._action_on_media("Like", media_id)
112
+
113
+ async def un_like_media(self, media_id: str):
114
+ return await self._action_on_media("Dislike", media_id)
115
+
116
+ async def add_wish_media(self, media_id: str):
117
+ return await self._action_on_media("AddWishList", media_id)
118
+
119
+ async def get_cast_medias(self, cast_id: str, start_id: str = "0"):
120
+ return await self._request_post("getCastMedias", {'cast_id': cast_id, 'start_id': start_id})
121
+
122
+ async def get_cast_info(self, cast_id: str):
123
+ return await self._request_post("getCastDetails", {'cast_id': cast_id})
124
+ async def get_Season_Episodes(self, season_id: str,series_id:str):
125
+ return await self._request_post("getSeasonEpisodes", {'season_id': season_id,"series_id":series_id})
126
+ async def get_Related(self, media_id: str,start_id:str="0"):
127
+ return await self._request_post("getRelated", {'media_id': media_id,"start_id":start_id})
128
+
129
+
130
+ async def close(self):
131
+ await self.client.aclose()
132
+
133
+ async def __aenter__(self):
134
+ return self
135
+
136
+ async def __aexit__(self, exc_type, exc_val, exc_tb):
137
+ await self.close()
@@ -13,7 +13,7 @@ with open("README.md", "r", encoding="utf-8") as f:
13
13
 
14
14
  setup(
15
15
  name='Rubka',
16
- version='6.6.8',
16
+ version='6.6.10',
17
17
  description='rubika A Python library for interacting with Rubika Bot API.',
18
18
  long_description=long_description,
19
19
  long_description_content_type='text/markdown',
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes