webscout 7.8__py3-none-any.whl → 8.0__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.

Potentially problematic release.


This version of webscout might be problematic. Click here for more details.

Files changed (66) hide show
  1. webscout/Bard.py +5 -25
  2. webscout/DWEBS.py +476 -476
  3. webscout/Extra/GitToolkit/__init__.py +10 -0
  4. webscout/Extra/GitToolkit/gitapi/__init__.py +12 -0
  5. webscout/Extra/GitToolkit/gitapi/repository.py +195 -0
  6. webscout/Extra/GitToolkit/gitapi/user.py +96 -0
  7. webscout/Extra/GitToolkit/gitapi/utils.py +62 -0
  8. webscout/Extra/YTToolkit/ytapi/video.py +232 -103
  9. webscout/Extra/__init__.py +2 -0
  10. webscout/Extra/autocoder/__init__.py +1 -1
  11. webscout/Extra/autocoder/{rawdog.py → autocoder.py} +849 -849
  12. webscout/Extra/tempmail/__init__.py +26 -0
  13. webscout/Extra/tempmail/async_utils.py +141 -0
  14. webscout/Extra/tempmail/base.py +156 -0
  15. webscout/Extra/tempmail/cli.py +187 -0
  16. webscout/Extra/tempmail/mail_tm.py +361 -0
  17. webscout/Extra/tempmail/temp_mail_io.py +292 -0
  18. webscout/Provider/AISEARCH/__init__.py +5 -1
  19. webscout/Provider/AISEARCH/hika_search.py +194 -0
  20. webscout/Provider/AISEARCH/monica_search.py +246 -0
  21. webscout/Provider/AISEARCH/scira_search.py +320 -0
  22. webscout/Provider/AISEARCH/webpilotai_search.py +281 -0
  23. webscout/Provider/AllenAI.py +255 -122
  24. webscout/Provider/DeepSeek.py +1 -2
  25. webscout/Provider/Deepinfra.py +296 -286
  26. webscout/Provider/ElectronHub.py +709 -716
  27. webscout/Provider/ExaAI.py +261 -0
  28. webscout/Provider/ExaChat.py +28 -6
  29. webscout/Provider/Gemini.py +167 -165
  30. webscout/Provider/GithubChat.py +2 -1
  31. webscout/Provider/Groq.py +38 -24
  32. webscout/Provider/LambdaChat.py +2 -1
  33. webscout/Provider/Netwrck.py +3 -2
  34. webscout/Provider/OpenGPT.py +199 -0
  35. webscout/Provider/PI.py +39 -24
  36. webscout/Provider/TextPollinationsAI.py +232 -230
  37. webscout/Provider/Youchat.py +326 -296
  38. webscout/Provider/__init__.py +10 -4
  39. webscout/Provider/ai4chat.py +58 -56
  40. webscout/Provider/akashgpt.py +34 -22
  41. webscout/Provider/copilot.py +427 -427
  42. webscout/Provider/freeaichat.py +9 -2
  43. webscout/Provider/labyrinth.py +121 -20
  44. webscout/Provider/llmchatco.py +306 -0
  45. webscout/Provider/scira_chat.py +271 -0
  46. webscout/Provider/typefully.py +280 -0
  47. webscout/Provider/uncovr.py +312 -299
  48. webscout/Provider/yep.py +64 -12
  49. webscout/__init__.py +38 -36
  50. webscout/cli.py +293 -293
  51. webscout/conversation.py +350 -17
  52. webscout/litprinter/__init__.py +59 -667
  53. webscout/optimizers.py +419 -419
  54. webscout/update_checker.py +14 -12
  55. webscout/version.py +1 -1
  56. webscout/webscout_search.py +1346 -1282
  57. webscout/webscout_search_async.py +877 -813
  58. {webscout-7.8.dist-info → webscout-8.0.dist-info}/METADATA +44 -39
  59. {webscout-7.8.dist-info → webscout-8.0.dist-info}/RECORD +63 -46
  60. webscout/Provider/DARKAI.py +0 -225
  61. webscout/Provider/EDITEE.py +0 -192
  62. webscout/litprinter/colors.py +0 -54
  63. {webscout-7.8.dist-info → webscout-8.0.dist-info}/LICENSE.md +0 -0
  64. {webscout-7.8.dist-info → webscout-8.0.dist-info}/WHEEL +0 -0
  65. {webscout-7.8.dist-info → webscout-8.0.dist-info}/entry_points.txt +0 -0
  66. {webscout-7.8.dist-info → webscout-8.0.dist-info}/top_level.txt +0 -0
@@ -1,103 +1,232 @@
1
- import re
2
- import json
3
- from .https import video_data
4
-
5
-
6
- class Video:
7
-
8
- _HEAD = 'https://www.youtube.com/watch?v='
9
-
10
- def __init__(self, video_id: str):
11
- """
12
- Represents a YouTube video
13
-
14
- Parameters
15
- ----------
16
- video_id : str
17
- The id or url of the video
18
- """
19
- pattern = re.compile('.be/(.*?)$|=(.*?)$|^(\w{11})$') # noqa
20
- self._matched_id = (
21
- pattern.search(video_id).group(1)
22
- or pattern.search(video_id).group(2)
23
- or pattern.search(video_id).group(3)
24
- )
25
- if self._matched_id:
26
- self._url = self._HEAD + self._matched_id
27
- self._video_data = video_data(self._matched_id)
28
- else:
29
- raise ValueError('invalid video id or url')
30
-
31
- def __repr__(self):
32
- return f'<Video {self._url}>'
33
-
34
- @property
35
- def metadata(self):
36
- """
37
- Fetches video metadata in a dict format
38
-
39
- Returns
40
- -------
41
- Dict
42
- Video metadata in a dict format containing keys: title, id, views, duration, author_id,
43
- upload_date, url, thumbnails, tags, description
44
- """
45
- details_pattern = re.compile('videoDetails\":(.*?)\"isLiveContent\":.*?}')
46
- upload_date_pattern = re.compile("<meta itemprop=\"uploadDate\" content=\"(.*?)\">")
47
- genre_pattern = re.compile("<meta itemprop=\"genre\" content=\"(.*?)\">")
48
- like_count_pattern = re.compile("iconType\":\"LIKE\"},\"defaultText\":(.*?)}}")
49
-
50
- # Add robust error handling
51
- raw_details_match = details_pattern.search(self._video_data)
52
- if not raw_details_match:
53
- # Fallback metadata for search results or incomplete video data
54
- return {
55
- 'title': getattr(self, 'title', None),
56
- 'id': getattr(self, 'id', None),
57
- 'views': getattr(self, 'views', None),
58
- 'streamed': False,
59
- 'duration': None,
60
- 'author_id': None,
61
- 'upload_date': None,
62
- 'url': f"https://www.youtube.com/watch?v={getattr(self, 'id', '')}" if hasattr(self, 'id') else None,
63
- 'thumbnails': None,
64
- 'tags': None,
65
- 'description': None,
66
- 'likes': None,
67
- 'genre': None
68
- }
69
-
70
- raw_details = raw_details_match.group(0)
71
-
72
- # Add None checking for upload_date
73
- upload_date_match = upload_date_pattern.search(self._video_data)
74
- upload_date = upload_date_match.group(1) if upload_date_match else None
75
-
76
- metadata = json.loads(raw_details.replace('videoDetails\":', ''))
77
- data = {
78
- 'title': metadata['title'],
79
- 'id': metadata['videoId'],
80
- 'views': metadata.get('viewCount'),
81
- 'streamed': metadata['isLiveContent'],
82
- 'duration': metadata['lengthSeconds'],
83
- 'author_id': metadata['channelId'],
84
- 'upload_date': upload_date,
85
- 'url': f"https://www.youtube.com/watch?v={metadata['videoId']}",
86
- 'thumbnails': metadata.get('thumbnail', {}).get('thumbnails'),
87
- 'tags': metadata.get('keywords'),
88
- 'description': metadata.get('shortDescription'),
89
- }
90
- try:
91
- likes_count = like_count_pattern.search(self._video_data).group(1)
92
- data['likes'] = json.loads(likes_count + '}}}')[
93
- 'accessibility'
94
- ]['accessibilityData']['label'].split(' ')[0].replace(',', '')
95
- except (AttributeError, KeyError, json.decoder.JSONDecodeError):
96
- data['likes'] = None
97
- try:
98
- data['genre'] = genre_pattern.search(self._video_data).group(1)
99
- except AttributeError:
100
- data['genre'] = None
101
- return data
102
- if __name__ == '__main__':
103
- print(Video('https://www.youtube.com/watch?v=9bZkp7q19f0').metadata)
1
+ import re
2
+ import json
3
+ from typing import Dict, Any
4
+ from .https import video_data
5
+
6
+
7
+ class Video:
8
+
9
+ _HEAD = 'https://www.youtube.com/watch?v='
10
+
11
+ def __init__(self, video_id: str):
12
+ """
13
+ Represents a YouTube video
14
+
15
+ Parameters
16
+ ----------
17
+ video_id : str
18
+ The id or url of the video
19
+ """
20
+ pattern = re.compile('.be/(.*?)$|=(.*?)$|^(\w{11})$') # noqa
21
+ match = pattern.search(video_id)
22
+
23
+ if not match:
24
+ raise ValueError('Invalid YouTube video ID or URL')
25
+
26
+ self._matched_id = (
27
+ match.group(1)
28
+ or match.group(2)
29
+ or match.group(3)
30
+ )
31
+
32
+ if self._matched_id:
33
+ self._url = self._HEAD + self._matched_id
34
+ self._video_data = video_data(self._matched_id)
35
+ # Extract basic info for fallback
36
+ title_match = re.search('<title>(.*?) - YouTube</title>', self._video_data)
37
+ self.title = title_match.group(1) if title_match else None
38
+ self.id = self._matched_id
39
+ else:
40
+ raise ValueError('Invalid YouTube video ID or URL')
41
+
42
+ def __repr__(self):
43
+ return f'<Video {self._url}>'
44
+
45
+ @property
46
+ def metadata(self) -> Dict[str, Any]:
47
+ """
48
+ Fetches video metadata in a dict format
49
+
50
+ Returns
51
+ -------
52
+ Dict
53
+ Video metadata in a dict format containing keys: title, id, views, duration, author_id,
54
+ upload_date, url, thumbnails, tags, description, likes, genre, etc.
55
+ """
56
+ # Multiple patterns to try for video details extraction for robustness
57
+ details_patterns = [
58
+ re.compile('videoDetails\":(.*?)\"isLiveContent\":.*?}'),
59
+ re.compile('videoDetails\":(.*?),\"playerConfig'),
60
+ re.compile('videoDetails\":(.*?),\"playabilityStatus')
61
+ ]
62
+
63
+ # Other metadata patterns
64
+ upload_date_pattern = re.compile("<meta itemprop=\"uploadDate\" content=\"(.*?)\">")
65
+ genre_pattern = re.compile("<meta itemprop=\"genre\" content=\"(.*?)\">")
66
+ like_count_patterns = [
67
+ re.compile("iconType\":\"LIKE\"},\"defaultText\":(.*?)}"),
68
+ re.compile('\"likeCount\":\"(\\d+)\"')
69
+ ]
70
+ channel_name_pattern = re.compile('"ownerChannelName":"(.*?)"')
71
+
72
+ # Try each pattern for video details
73
+ raw_details_match = None
74
+ for pattern in details_patterns:
75
+ match = pattern.search(self._video_data)
76
+ if match:
77
+ raw_details_match = match
78
+ break
79
+
80
+ if not raw_details_match:
81
+ # Fallback metadata for search results or incomplete video data
82
+ return {
83
+ 'title': getattr(self, 'title', None),
84
+ 'id': getattr(self, 'id', None),
85
+ 'views': getattr(self, 'views', None),
86
+ 'streamed': False,
87
+ 'duration': None,
88
+ 'author_id': None,
89
+ 'author_name': None,
90
+ 'upload_date': None,
91
+ 'url': f"https://www.youtube.com/watch?v={getattr(self, 'id', '')}" if hasattr(self, 'id') else None,
92
+ 'thumbnails': None,
93
+ 'tags': None,
94
+ 'description': None,
95
+ 'likes': None,
96
+ 'genre': None,
97
+ 'is_age_restricted': 'age-restricted' in self._video_data.lower(),
98
+ 'is_unlisted': 'unlisted' in self._video_data.lower()
99
+ }
100
+
101
+ raw_details = raw_details_match.group(0)
102
+
103
+ # Extract upload date
104
+ upload_date_match = upload_date_pattern.search(self._video_data)
105
+ upload_date = upload_date_match.group(1) if upload_date_match else None
106
+
107
+ # Extract channel name
108
+ channel_name_match = channel_name_pattern.search(self._video_data)
109
+ channel_name = channel_name_match.group(1) if channel_name_match else None
110
+
111
+ # Parse video details
112
+ try:
113
+ # Clean up the JSON string for parsing
114
+ clean_json = raw_details.replace('videoDetails\":', '')
115
+ # Handle potential JSON parsing issues
116
+ if clean_json.endswith(','):
117
+ clean_json = clean_json[:-1]
118
+ metadata = json.loads(clean_json)
119
+
120
+ data = {
121
+ 'title': metadata.get('title'),
122
+ 'id': metadata.get('videoId', self._matched_id),
123
+ 'views': metadata.get('viewCount'),
124
+ 'streamed': metadata.get('isLiveContent', False),
125
+ 'duration': metadata.get('lengthSeconds'),
126
+ 'author_id': metadata.get('channelId'),
127
+ 'author_name': channel_name or metadata.get('author'),
128
+ 'upload_date': upload_date,
129
+ 'url': f"https://www.youtube.com/watch?v={metadata.get('videoId', self._matched_id)}",
130
+ 'thumbnails': metadata.get('thumbnail', {}).get('thumbnails'),
131
+ 'tags': metadata.get('keywords'),
132
+ 'description': metadata.get('shortDescription'),
133
+ 'is_age_restricted': metadata.get('isAgeRestricted', False) or 'age-restricted' in self._video_data.lower(),
134
+ 'is_unlisted': 'unlisted' in self._video_data.lower(),
135
+ 'is_family_safe': metadata.get('isFamilySafe', True),
136
+ 'is_private': metadata.get('isPrivate', False),
137
+ 'is_live_content': metadata.get('isLiveContent', False),
138
+ 'is_crawlable': metadata.get('isCrawlable', True),
139
+ 'allow_ratings': metadata.get('allowRatings', True)
140
+ }
141
+ except (json.JSONDecodeError, KeyError, TypeError) as e:
142
+ # Fallback to basic metadata if JSON parsing fails
143
+ return {
144
+ 'title': getattr(self, 'title', None),
145
+ 'id': self._matched_id,
146
+ 'url': self._url,
147
+ 'error': f"Failed to parse video details: {str(e)}"
148
+ }
149
+
150
+ # Try to extract likes count
151
+ likes = None
152
+ for pattern in like_count_patterns:
153
+ try:
154
+ likes_match = pattern.search(self._video_data)
155
+ if likes_match:
156
+ likes_text = likes_match.group(1)
157
+ # Handle different formats of like count
158
+ if '{' in likes_text:
159
+ likes = json.loads(likes_text + '}}}')['accessibility']['accessibilityData']['label'].split(' ')[0].replace(',', '')
160
+ else:
161
+ likes = likes_text
162
+ break
163
+ except (AttributeError, KeyError, json.decoder.JSONDecodeError):
164
+ continue
165
+
166
+ data['likes'] = likes
167
+
168
+ # Try to extract genre
169
+ try:
170
+ genre_match = genre_pattern.search(self._video_data)
171
+ data['genre'] = genre_match.group(1) if genre_match else None
172
+ except AttributeError:
173
+ data['genre'] = None
174
+
175
+ return data
176
+
177
+
178
+
179
+ @property
180
+ def embed_html(self) -> str:
181
+ """
182
+ Get the embed HTML code for this video
183
+
184
+ Returns:
185
+ HTML iframe code for embedding the video
186
+ """
187
+ return f'<iframe width="560" height="315" src="https://www.youtube.com/embed/{self._matched_id}" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>'
188
+
189
+ @property
190
+ def embed_url(self) -> str:
191
+ """
192
+ Get the embed URL for this video
193
+
194
+ Returns:
195
+ URL for embedding the video
196
+ """
197
+ return f'https://www.youtube.com/embed/{self._matched_id}'
198
+
199
+ @property
200
+ def thumbnail_url(self) -> str:
201
+ """
202
+ Get the thumbnail URL for this video
203
+
204
+ Returns:
205
+ URL of the video thumbnail (high quality)
206
+ """
207
+ return f'https://i.ytimg.com/vi/{self._matched_id}/hqdefault.jpg'
208
+
209
+ @property
210
+ def thumbnail_urls(self) -> Dict[str, str]:
211
+ """
212
+ Get all thumbnail URLs for this video in different qualities
213
+
214
+ Returns:
215
+ Dictionary of thumbnail URLs with quality labels
216
+ """
217
+ return {
218
+ 'default': f'https://i.ytimg.com/vi/{self._matched_id}/default.jpg',
219
+ 'medium': f'https://i.ytimg.com/vi/{self._matched_id}/mqdefault.jpg',
220
+ 'high': f'https://i.ytimg.com/vi/{self._matched_id}/hqdefault.jpg',
221
+ 'standard': f'https://i.ytimg.com/vi/{self._matched_id}/sddefault.jpg',
222
+ 'maxres': f'https://i.ytimg.com/vi/{self._matched_id}/maxresdefault.jpg'
223
+ }
224
+
225
+ if __name__ == '__main__':
226
+ video = Video('https://www.youtube.com/watch?v=9bZkp7q19f0')
227
+ print(video.metadata)
228
+
229
+ # Example of getting comments
230
+ print("\nFirst 3 comments:")
231
+ for i, comment in enumerate(video.stream_comments(3), 1):
232
+ print(f"{i}. {comment['author']}: {comment['text'][:50]}...")
@@ -3,3 +3,5 @@ from .weather import *
3
3
  from .weather_ascii import *
4
4
  from .autocoder import *
5
5
  from .YTToolkit import *
6
+ from .GitToolkit import *
7
+ from .tempmail import *
@@ -3,7 +3,7 @@ AutoCoder Module - Part of Webscout
3
3
  Provides automated code generation and manipulation capabilities.
4
4
  """
5
5
 
6
- from .rawdog import *
6
+ from .autocoder import *
7
7
  from .autocoder_utiles import *
8
8
 
9
9
  # __all__ = [] # Add your public module names here