webscout 7.1__py3-none-any.whl → 7.2__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 (144) hide show
  1. webscout/AIauto.py +191 -191
  2. webscout/AIbase.py +122 -122
  3. webscout/AIutel.py +440 -440
  4. webscout/Bard.py +343 -161
  5. webscout/DWEBS.py +489 -492
  6. webscout/Extra/YTToolkit/YTdownloader.py +995 -995
  7. webscout/Extra/YTToolkit/__init__.py +2 -2
  8. webscout/Extra/YTToolkit/transcriber.py +476 -479
  9. webscout/Extra/YTToolkit/ytapi/channel.py +307 -307
  10. webscout/Extra/YTToolkit/ytapi/playlist.py +58 -58
  11. webscout/Extra/YTToolkit/ytapi/pool.py +7 -7
  12. webscout/Extra/YTToolkit/ytapi/utils.py +62 -62
  13. webscout/Extra/YTToolkit/ytapi/video.py +103 -103
  14. webscout/Extra/autocoder/__init__.py +9 -9
  15. webscout/Extra/autocoder/autocoder_utiles.py +199 -199
  16. webscout/Extra/autocoder/rawdog.py +5 -7
  17. webscout/Extra/autollama.py +230 -230
  18. webscout/Extra/gguf.py +3 -3
  19. webscout/Extra/weather.py +171 -171
  20. webscout/LLM.py +442 -442
  21. webscout/Litlogger/__init__.py +67 -681
  22. webscout/Litlogger/core/__init__.py +6 -0
  23. webscout/Litlogger/core/level.py +20 -0
  24. webscout/Litlogger/core/logger.py +123 -0
  25. webscout/Litlogger/handlers/__init__.py +12 -0
  26. webscout/Litlogger/handlers/console.py +50 -0
  27. webscout/Litlogger/handlers/file.py +143 -0
  28. webscout/Litlogger/handlers/network.py +174 -0
  29. webscout/Litlogger/styles/__init__.py +7 -0
  30. webscout/Litlogger/styles/colors.py +231 -0
  31. webscout/Litlogger/styles/formats.py +377 -0
  32. webscout/Litlogger/styles/text.py +87 -0
  33. webscout/Litlogger/utils/__init__.py +6 -0
  34. webscout/Litlogger/utils/detectors.py +154 -0
  35. webscout/Litlogger/utils/formatters.py +200 -0
  36. webscout/Provider/AISEARCH/DeepFind.py +250 -250
  37. webscout/Provider/Blackboxai.py +3 -3
  38. webscout/Provider/ChatGPTGratis.py +226 -0
  39. webscout/Provider/Cloudflare.py +3 -4
  40. webscout/Provider/DeepSeek.py +218 -0
  41. webscout/Provider/Deepinfra.py +3 -3
  42. webscout/Provider/Free2GPT.py +131 -124
  43. webscout/Provider/Gemini.py +100 -115
  44. webscout/Provider/Glider.py +3 -3
  45. webscout/Provider/Groq.py +5 -1
  46. webscout/Provider/Jadve.py +3 -3
  47. webscout/Provider/Marcus.py +191 -192
  48. webscout/Provider/Netwrck.py +3 -3
  49. webscout/Provider/PI.py +2 -2
  50. webscout/Provider/PizzaGPT.py +2 -3
  51. webscout/Provider/QwenLM.py +311 -0
  52. webscout/Provider/TTI/AiForce/__init__.py +22 -22
  53. webscout/Provider/TTI/AiForce/async_aiforce.py +257 -257
  54. webscout/Provider/TTI/AiForce/sync_aiforce.py +242 -242
  55. webscout/Provider/TTI/Nexra/__init__.py +22 -22
  56. webscout/Provider/TTI/Nexra/async_nexra.py +286 -286
  57. webscout/Provider/TTI/Nexra/sync_nexra.py +258 -258
  58. webscout/Provider/TTI/PollinationsAI/__init__.py +23 -23
  59. webscout/Provider/TTI/PollinationsAI/async_pollinations.py +330 -330
  60. webscout/Provider/TTI/PollinationsAI/sync_pollinations.py +285 -285
  61. webscout/Provider/TTI/artbit/__init__.py +22 -22
  62. webscout/Provider/TTI/artbit/async_artbit.py +184 -184
  63. webscout/Provider/TTI/artbit/sync_artbit.py +176 -176
  64. webscout/Provider/TTI/blackbox/__init__.py +4 -4
  65. webscout/Provider/TTI/blackbox/async_blackbox.py +212 -212
  66. webscout/Provider/TTI/blackbox/sync_blackbox.py +199 -199
  67. webscout/Provider/TTI/deepinfra/__init__.py +4 -4
  68. webscout/Provider/TTI/deepinfra/async_deepinfra.py +227 -227
  69. webscout/Provider/TTI/deepinfra/sync_deepinfra.py +199 -199
  70. webscout/Provider/TTI/huggingface/__init__.py +22 -22
  71. webscout/Provider/TTI/huggingface/async_huggingface.py +199 -199
  72. webscout/Provider/TTI/huggingface/sync_huggingface.py +195 -195
  73. webscout/Provider/TTI/imgninza/__init__.py +4 -4
  74. webscout/Provider/TTI/imgninza/async_ninza.py +214 -214
  75. webscout/Provider/TTI/imgninza/sync_ninza.py +209 -209
  76. webscout/Provider/TTI/talkai/__init__.py +4 -4
  77. webscout/Provider/TTI/talkai/async_talkai.py +229 -229
  78. webscout/Provider/TTI/talkai/sync_talkai.py +207 -207
  79. webscout/Provider/TTS/deepgram.py +182 -182
  80. webscout/Provider/TTS/elevenlabs.py +136 -136
  81. webscout/Provider/TTS/gesserit.py +150 -150
  82. webscout/Provider/TTS/murfai.py +138 -138
  83. webscout/Provider/TTS/parler.py +133 -134
  84. webscout/Provider/TTS/streamElements.py +360 -360
  85. webscout/Provider/TTS/utils.py +280 -280
  86. webscout/Provider/TTS/voicepod.py +116 -116
  87. webscout/Provider/TextPollinationsAI.py +2 -3
  88. webscout/Provider/WiseCat.py +193 -0
  89. webscout/Provider/__init__.py +144 -134
  90. webscout/Provider/cerebras.py +242 -227
  91. webscout/Provider/chatglm.py +204 -204
  92. webscout/Provider/dgaf.py +2 -3
  93. webscout/Provider/gaurish.py +2 -3
  94. webscout/Provider/geminiapi.py +208 -208
  95. webscout/Provider/granite.py +223 -0
  96. webscout/Provider/hermes.py +218 -218
  97. webscout/Provider/llama3mitril.py +179 -179
  98. webscout/Provider/llamatutor.py +3 -3
  99. webscout/Provider/llmchat.py +2 -3
  100. webscout/Provider/meta.py +794 -794
  101. webscout/Provider/multichat.py +331 -331
  102. webscout/Provider/typegpt.py +359 -359
  103. webscout/Provider/yep.py +2 -2
  104. webscout/__main__.py +5 -5
  105. webscout/cli.py +319 -319
  106. webscout/conversation.py +241 -242
  107. webscout/exceptions.py +328 -328
  108. webscout/litagent/__init__.py +28 -28
  109. webscout/litagent/agent.py +2 -3
  110. webscout/litprinter/__init__.py +0 -58
  111. webscout/scout/__init__.py +8 -8
  112. webscout/scout/core.py +884 -884
  113. webscout/scout/element.py +459 -459
  114. webscout/scout/parsers/__init__.py +69 -69
  115. webscout/scout/parsers/html5lib_parser.py +172 -172
  116. webscout/scout/parsers/html_parser.py +236 -236
  117. webscout/scout/parsers/lxml_parser.py +178 -178
  118. webscout/scout/utils.py +38 -38
  119. webscout/swiftcli/__init__.py +811 -811
  120. webscout/update_checker.py +2 -12
  121. webscout/version.py +1 -1
  122. webscout/webscout_search.py +5 -4
  123. webscout/zeroart/__init__.py +54 -54
  124. webscout/zeroart/base.py +60 -60
  125. webscout/zeroart/effects.py +99 -99
  126. webscout/zeroart/fonts.py +816 -816
  127. {webscout-7.1.dist-info → webscout-7.2.dist-info}/METADATA +4 -3
  128. webscout-7.2.dist-info/RECORD +217 -0
  129. webstoken/__init__.py +30 -30
  130. webstoken/classifier.py +189 -189
  131. webstoken/keywords.py +216 -216
  132. webstoken/language.py +128 -128
  133. webstoken/ner.py +164 -164
  134. webstoken/normalizer.py +35 -35
  135. webstoken/processor.py +77 -77
  136. webstoken/sentiment.py +206 -206
  137. webstoken/stemmer.py +73 -73
  138. webstoken/tagger.py +60 -60
  139. webstoken/tokenizer.py +158 -158
  140. webscout-7.1.dist-info/RECORD +0 -198
  141. {webscout-7.1.dist-info → webscout-7.2.dist-info}/LICENSE.md +0 -0
  142. {webscout-7.1.dist-info → webscout-7.2.dist-info}/WHEEL +0 -0
  143. {webscout-7.1.dist-info → webscout-7.2.dist-info}/entry_points.txt +0 -0
  144. {webscout-7.1.dist-info → webscout-7.2.dist-info}/top_level.txt +0 -0
webscout/exceptions.py CHANGED
@@ -1,329 +1,329 @@
1
- WATCH_URL = 'https://www.youtube.com/watch?v={video_id}'
2
-
3
-
4
- class WebscoutE(Exception):
5
- """
6
- Base exception class for all Webscout related errors.
7
-
8
- This class serves as the root for all custom exceptions raised by the Webscout library.
9
- It provides a common base for catching and handling errors specific to Webscout.
10
- """
11
- pass
12
-
13
-
14
- class APIConnectionError(Exception):
15
- """
16
- Exception raised when there are issues connecting to an API.
17
-
18
- This exception is raised when a network connection to an external API fails.
19
- It indicates a problem with the network or the API server itself.
20
- """
21
- pass
22
-
23
-
24
- class RatelimitE(Exception):
25
- """
26
- Exception raised when an API rate limit is exceeded.
27
-
28
- This exception is raised when the number of requests to an API exceeds the allowed limit within a given time frame.
29
- It indicates that the application is making too many requests and needs to slow down.
30
- """
31
- pass
32
-
33
-
34
- class ConversationLimitException(Exception):
35
- """
36
- Exception raised when a conversation limit is exceeded.
37
-
38
- This exception is raised when a limit on the number of turns or messages in a conversation is exceeded.
39
- It indicates that the conversation has reached its maximum allowed length.
40
- """
41
- pass
42
-
43
-
44
- class TimeoutE(Exception):
45
- """
46
- Exception raised when a request to an API times out.
47
-
48
- This exception is raised when a request to an API takes longer than the allowed time to complete.
49
- It indicates a problem with the network or the API server being slow to respond.
50
- """
51
- pass
52
-
53
-
54
- class FailedToGenerateResponseError(Exception):
55
- """
56
- Exception raised when a provider fails to generate a response.
57
-
58
- This exception is raised when a provider is unable to generate a response for a given request.
59
- It indicates an issue with the provider's logic or data.
60
- """
61
- pass
62
-
63
-
64
- class AllProvidersFailure(Exception):
65
- """
66
- Exception raised when all providers fail to generate a response.
67
-
68
- This exception is raised when none of the available providers are able to generate a response for a given request.
69
- It indicates a widespread issue with all providers.
70
- """
71
- pass
72
-
73
-
74
- class FacebookInvalidCredentialsException(Exception):
75
- """
76
- Exception raised when Facebook credentials are invalid.
77
-
78
- This exception is raised when the provided Facebook credentials (e.g., username, password, cookies) are invalid.
79
- It indicates that the application is unable to authenticate with Facebook.
80
- """
81
- pass
82
-
83
-
84
- class FacebookRegionBlocked(Exception):
85
- """
86
- Exception raised when Facebook access is blocked due to region restrictions.
87
-
88
- This exception is raised when access to Facebook is blocked due to geographical restrictions.
89
- It indicates that the application is unable to access Facebook from the current location.
90
- """
91
- pass
92
-
93
-
94
- class ModelUnloadedException(Exception):
95
- """
96
- Exception raised when a model is unloaded.
97
-
98
- This exception is raised when a required model is not loaded or has been unloaded.
99
- It indicates that the application is unable to perform operations that require the model.
100
- """
101
- pass
102
-
103
-
104
- class TranscriptRetrievalError(WebscoutE):
105
- """
106
- Base class for transcript retrieval errors.
107
-
108
- This class serves as the root for all custom exceptions related to transcript retrieval.
109
- It provides a common base for catching and handling errors specific to transcript retrieval.
110
-
111
- Args:
112
- video_id (str): The ID of the video for which the transcript retrieval failed.
113
- message (str): A message describing the error.
114
- """
115
-
116
- def __init__(self, video_id, message):
117
- super().__init__(message.format(video_url=WATCH_URL.format(video_id=video_id)))
118
- self.video_id = video_id
119
-
120
-
121
- class YouTubeRequestFailedError(TranscriptRetrievalError):
122
- """
123
- Exception raised when a request to YouTube fails.
124
-
125
- This exception is raised when a network request to YouTube fails.
126
- It indicates a problem with the network or the YouTube server itself.
127
-
128
- Args:
129
- video_id (str): The ID of the video for which the request failed.
130
- http_error (str): The HTTP error that occurred.
131
- """
132
-
133
- def __init__(self, video_id, http_error):
134
- message = 'Request to YouTube failed: {reason}'
135
- super().__init__(video_id, message.format(reason=str(http_error)))
136
-
137
-
138
- class VideoUnavailableError(TranscriptRetrievalError):
139
- """
140
- Exception raised when the video is unavailable.
141
-
142
- This exception is raised when the requested video is no longer available on YouTube.
143
- It indicates that the video has been removed or made private.
144
-
145
- Args:
146
- video_id (str): The ID of the unavailable video.
147
- """
148
-
149
- def __init__(self, video_id):
150
- message = 'The video is no longer available'
151
- super().__init__(video_id, message)
152
-
153
-
154
- class InvalidVideoIdError(TranscriptRetrievalError):
155
- """
156
- Exception raised when an invalid video ID is provided.
157
-
158
- This exception is raised when the provided video ID is not in the correct format.
159
- It indicates that the application is using a URL instead of the video ID.
160
-
161
- Args:
162
- video_id (str): The invalid video ID.
163
- """
164
-
165
- def __init__(self, video_id):
166
- message = (
167
- 'You provided an invalid video id. Make sure you are using the video id and NOT the url!\n\n'
168
- 'Do NOT run: `YTTranscriber.get_transcript("https://www.youtube.com/watch?v=1234")`\n'
169
- 'Instead run: `YTTranscriber.get_transcript("1234")`'
170
- )
171
- super().__init__(video_id, message)
172
-
173
-
174
- class TooManyRequestsError(TranscriptRetrievalError):
175
- """
176
- Exception raised when YouTube rate limits the requests.
177
-
178
- This exception is raised when YouTube rate limits the requests from the current IP address.
179
- It indicates that the application is making too many requests and needs to slow down or use a different IP.
180
-
181
- Args:
182
- video_id (str): The ID of the video for which the request was rate-limited.
183
- """
184
-
185
- def __init__(self, video_id):
186
- message = (
187
- 'YouTube is receiving too many requests from this IP and now requires solving a captcha to continue. '
188
- 'One of the following things can be done to work around this:\n\
189
- - Manually solve the captcha in a browser and export the cookie. '
190
- '- Use a different IP address\n\
191
- - Wait until the ban on your IP has been lifted'
192
- )
193
- super().__init__(video_id, message)
194
-
195
-
196
- class TranscriptsDisabledError(TranscriptRetrievalError):
197
- """
198
- Exception raised when transcripts are disabled for the video.
199
-
200
- This exception is raised when the video has subtitles disabled.
201
- It indicates that the application cannot retrieve transcripts for this video.
202
-
203
- Args:
204
- video_id (str): The ID of the video with disabled transcripts.
205
- """
206
-
207
- def __init__(self, video_id):
208
- message = 'Subtitles are disabled for this video'
209
- super().__init__(video_id, message)
210
-
211
-
212
- class NoTranscriptAvailableError(TranscriptRetrievalError):
213
- """
214
- Exception raised when no transcripts are available for the video.
215
-
216
- This exception is raised when the video has no transcripts available.
217
- It indicates that the application cannot retrieve transcripts for this video.
218
-
219
- Args:
220
- video_id (str): The ID of the video with no available transcripts.
221
- """
222
-
223
- def __init__(self, video_id):
224
- message = 'No transcripts are available for this video'
225
- super().__init__(video_id, message)
226
-
227
-
228
- class NotTranslatableError(TranscriptRetrievalError):
229
- """
230
- Exception raised when the transcript is not translatable.
231
-
232
- This exception is raised when the requested language is not translatable.
233
- It indicates that the application cannot translate the transcript to the requested language.
234
-
235
- Args:
236
- video_id (str): The ID of the video with a non-translatable transcript.
237
- """
238
-
239
- def __init__(self, video_id):
240
- message = 'The requested language is not translatable'
241
- super().__init__(video_id, message)
242
-
243
-
244
- class TranslationLanguageNotAvailableError(TranscriptRetrievalError):
245
- """
246
- Exception raised when the requested translation language is not available.
247
-
248
- This exception is raised when the requested translation language is not supported for the transcript.
249
- It indicates that the application cannot translate the transcript to the requested language.
250
-
251
- Args:
252
- video_id (str): The ID of the video for which the translation language is not available.
253
- """
254
-
255
- def __init__(self, video_id):
256
- message = 'The requested translation language is not available'
257
- super().__init__(video_id, message)
258
-
259
-
260
- class CookiePathInvalidError(TranscriptRetrievalError):
261
- """
262
- Exception raised when the cookie path is invalid.
263
-
264
- This exception is raised when the provided cookie path is invalid.
265
- It indicates that the application cannot access the cookie file.
266
-
267
- Args:
268
- video_id (str): The ID of the video for which the cookie path is invalid.
269
- """
270
-
271
- def __init__(self, video_id):
272
- message = 'The provided cookie path is invalid'
273
- super().__init__(video_id, message)
274
-
275
-
276
- class CookiesInvalidError(TranscriptRetrievalError):
277
- """
278
- Exception raised when the provided cookies are invalid.
279
-
280
- This exception is raised when the provided cookies are not valid or have expired.
281
- It indicates that the application cannot authenticate with YouTube using the provided cookies.
282
-
283
- Args:
284
- video_id (str): The ID of the video for which the cookies are invalid.
285
- """
286
-
287
- def __init__(self, video_id):
288
- message = 'The cookies provided are not valid (may have expired)'
289
- super().__init__(video_id, message)
290
-
291
-
292
- class FailedToCreateConsentCookieError(TranscriptRetrievalError):
293
- """
294
- Exception raised when consent cookie creation fails.
295
-
296
- This exception is raised when the application fails to automatically give consent to saving cookies.
297
- It indicates that the application cannot proceed without the consent cookie.
298
-
299
- Args:
300
- video_id (str): The ID of the video for which the consent cookie creation failed.
301
- """
302
-
303
- def __init__(self, video_id):
304
- message = 'Failed to automatically give consent to saving cookies'
305
- super().__init__(video_id, message)
306
-
307
-
308
- class NoTranscriptFoundError(TranscriptRetrievalError):
309
- """
310
- Exception raised when no transcript is found for the requested language codes.
311
-
312
- This exception is raised when no transcripts are found for any of the requested language codes.
313
- It indicates that the application cannot retrieve transcripts for the requested languages.
314
-
315
- Args:
316
- video_id (str): The ID of the video for which no transcript was found.
317
- requested_language_codes (list): The list of requested language codes.
318
- transcript_data (dict): The transcript data that was found.
319
- """
320
-
321
- def __init__(self, video_id, requested_language_codes, transcript_data):
322
- message = (
323
- 'No transcripts were found for any of the requested language codes: {requested_language_codes}\n\n'
324
- '{transcript_data}'
325
- )
326
- super().__init__(video_id, message.format(
327
- requested_language_codes=requested_language_codes,
328
- transcript_data=str(transcript_data)
1
+ WATCH_URL = 'https://www.youtube.com/watch?v={video_id}'
2
+
3
+
4
+ class WebscoutE(Exception):
5
+ """
6
+ Base exception class for all Webscout related errors.
7
+
8
+ This class serves as the root for all custom exceptions raised by the Webscout library.
9
+ It provides a common base for catching and handling errors specific to Webscout.
10
+ """
11
+ pass
12
+
13
+
14
+ class APIConnectionError(Exception):
15
+ """
16
+ Exception raised when there are issues connecting to an API.
17
+
18
+ This exception is raised when a network connection to an external API fails.
19
+ It indicates a problem with the network or the API server itself.
20
+ """
21
+ pass
22
+
23
+
24
+ class RatelimitE(Exception):
25
+ """
26
+ Exception raised when an API rate limit is exceeded.
27
+
28
+ This exception is raised when the number of requests to an API exceeds the allowed limit within a given time frame.
29
+ It indicates that the application is making too many requests and needs to slow down.
30
+ """
31
+ pass
32
+
33
+
34
+ class ConversationLimitException(Exception):
35
+ """
36
+ Exception raised when a conversation limit is exceeded.
37
+
38
+ This exception is raised when a limit on the number of turns or messages in a conversation is exceeded.
39
+ It indicates that the conversation has reached its maximum allowed length.
40
+ """
41
+ pass
42
+
43
+
44
+ class TimeoutE(Exception):
45
+ """
46
+ Exception raised when a request to an API times out.
47
+
48
+ This exception is raised when a request to an API takes longer than the allowed time to complete.
49
+ It indicates a problem with the network or the API server being slow to respond.
50
+ """
51
+ pass
52
+
53
+
54
+ class FailedToGenerateResponseError(Exception):
55
+ """
56
+ Exception raised when a provider fails to generate a response.
57
+
58
+ This exception is raised when a provider is unable to generate a response for a given request.
59
+ It indicates an issue with the provider's logic or data.
60
+ """
61
+ pass
62
+
63
+
64
+ class AllProvidersFailure(Exception):
65
+ """
66
+ Exception raised when all providers fail to generate a response.
67
+
68
+ This exception is raised when none of the available providers are able to generate a response for a given request.
69
+ It indicates a widespread issue with all providers.
70
+ """
71
+ pass
72
+
73
+
74
+ class FacebookInvalidCredentialsException(Exception):
75
+ """
76
+ Exception raised when Facebook credentials are invalid.
77
+
78
+ This exception is raised when the provided Facebook credentials (e.g., username, password, cookies) are invalid.
79
+ It indicates that the application is unable to authenticate with Facebook.
80
+ """
81
+ pass
82
+
83
+
84
+ class FacebookRegionBlocked(Exception):
85
+ """
86
+ Exception raised when Facebook access is blocked due to region restrictions.
87
+
88
+ This exception is raised when access to Facebook is blocked due to geographical restrictions.
89
+ It indicates that the application is unable to access Facebook from the current location.
90
+ """
91
+ pass
92
+
93
+
94
+ class ModelUnloadedException(Exception):
95
+ """
96
+ Exception raised when a model is unloaded.
97
+
98
+ This exception is raised when a required model is not loaded or has been unloaded.
99
+ It indicates that the application is unable to perform operations that require the model.
100
+ """
101
+ pass
102
+
103
+
104
+ class TranscriptRetrievalError(WebscoutE):
105
+ """
106
+ Base class for transcript retrieval errors.
107
+
108
+ This class serves as the root for all custom exceptions related to transcript retrieval.
109
+ It provides a common base for catching and handling errors specific to transcript retrieval.
110
+
111
+ Args:
112
+ video_id (str): The ID of the video for which the transcript retrieval failed.
113
+ message (str): A message describing the error.
114
+ """
115
+
116
+ def __init__(self, video_id, message):
117
+ super().__init__(message.format(video_url=WATCH_URL.format(video_id=video_id)))
118
+ self.video_id = video_id
119
+
120
+
121
+ class YouTubeRequestFailedError(TranscriptRetrievalError):
122
+ """
123
+ Exception raised when a request to YouTube fails.
124
+
125
+ This exception is raised when a network request to YouTube fails.
126
+ It indicates a problem with the network or the YouTube server itself.
127
+
128
+ Args:
129
+ video_id (str): The ID of the video for which the request failed.
130
+ http_error (str): The HTTP error that occurred.
131
+ """
132
+
133
+ def __init__(self, video_id, http_error):
134
+ message = 'Request to YouTube failed: {reason}'
135
+ super().__init__(video_id, message.format(reason=str(http_error)))
136
+
137
+
138
+ class VideoUnavailableError(TranscriptRetrievalError):
139
+ """
140
+ Exception raised when the video is unavailable.
141
+
142
+ This exception is raised when the requested video is no longer available on YouTube.
143
+ It indicates that the video has been removed or made private.
144
+
145
+ Args:
146
+ video_id (str): The ID of the unavailable video.
147
+ """
148
+
149
+ def __init__(self, video_id):
150
+ message = 'The video is no longer available'
151
+ super().__init__(video_id, message)
152
+
153
+
154
+ class InvalidVideoIdError(TranscriptRetrievalError):
155
+ """
156
+ Exception raised when an invalid video ID is provided.
157
+
158
+ This exception is raised when the provided video ID is not in the correct format.
159
+ It indicates that the application is using a URL instead of the video ID.
160
+
161
+ Args:
162
+ video_id (str): The invalid video ID.
163
+ """
164
+
165
+ def __init__(self, video_id):
166
+ message = (
167
+ 'You provided an invalid video id. Make sure you are using the video id and NOT the url!\n\n'
168
+ 'Do NOT run: `YTTranscriber.get_transcript("https://www.youtube.com/watch?v=1234")`\n'
169
+ 'Instead run: `YTTranscriber.get_transcript("1234")`'
170
+ )
171
+ super().__init__(video_id, message)
172
+
173
+
174
+ class TooManyRequestsError(TranscriptRetrievalError):
175
+ """
176
+ Exception raised when YouTube rate limits the requests.
177
+
178
+ This exception is raised when YouTube rate limits the requests from the current IP address.
179
+ It indicates that the application is making too many requests and needs to slow down or use a different IP.
180
+
181
+ Args:
182
+ video_id (str): The ID of the video for which the request was rate-limited.
183
+ """
184
+
185
+ def __init__(self, video_id):
186
+ message = (
187
+ 'YouTube is receiving too many requests from this IP and now requires solving a captcha to continue. '
188
+ 'One of the following things can be done to work around this:\n\
189
+ - Manually solve the captcha in a browser and export the cookie. '
190
+ '- Use a different IP address\n\
191
+ - Wait until the ban on your IP has been lifted'
192
+ )
193
+ super().__init__(video_id, message)
194
+
195
+
196
+ class TranscriptsDisabledError(TranscriptRetrievalError):
197
+ """
198
+ Exception raised when transcripts are disabled for the video.
199
+
200
+ This exception is raised when the video has subtitles disabled.
201
+ It indicates that the application cannot retrieve transcripts for this video.
202
+
203
+ Args:
204
+ video_id (str): The ID of the video with disabled transcripts.
205
+ """
206
+
207
+ def __init__(self, video_id):
208
+ message = 'Subtitles are disabled for this video'
209
+ super().__init__(video_id, message)
210
+
211
+
212
+ class NoTranscriptAvailableError(TranscriptRetrievalError):
213
+ """
214
+ Exception raised when no transcripts are available for the video.
215
+
216
+ This exception is raised when the video has no transcripts available.
217
+ It indicates that the application cannot retrieve transcripts for this video.
218
+
219
+ Args:
220
+ video_id (str): The ID of the video with no available transcripts.
221
+ """
222
+
223
+ def __init__(self, video_id):
224
+ message = 'No transcripts are available for this video'
225
+ super().__init__(video_id, message)
226
+
227
+
228
+ class NotTranslatableError(TranscriptRetrievalError):
229
+ """
230
+ Exception raised when the transcript is not translatable.
231
+
232
+ This exception is raised when the requested language is not translatable.
233
+ It indicates that the application cannot translate the transcript to the requested language.
234
+
235
+ Args:
236
+ video_id (str): The ID of the video with a non-translatable transcript.
237
+ """
238
+
239
+ def __init__(self, video_id):
240
+ message = 'The requested language is not translatable'
241
+ super().__init__(video_id, message)
242
+
243
+
244
+ class TranslationLanguageNotAvailableError(TranscriptRetrievalError):
245
+ """
246
+ Exception raised when the requested translation language is not available.
247
+
248
+ This exception is raised when the requested translation language is not supported for the transcript.
249
+ It indicates that the application cannot translate the transcript to the requested language.
250
+
251
+ Args:
252
+ video_id (str): The ID of the video for which the translation language is not available.
253
+ """
254
+
255
+ def __init__(self, video_id):
256
+ message = 'The requested translation language is not available'
257
+ super().__init__(video_id, message)
258
+
259
+
260
+ class CookiePathInvalidError(TranscriptRetrievalError):
261
+ """
262
+ Exception raised when the cookie path is invalid.
263
+
264
+ This exception is raised when the provided cookie path is invalid.
265
+ It indicates that the application cannot access the cookie file.
266
+
267
+ Args:
268
+ video_id (str): The ID of the video for which the cookie path is invalid.
269
+ """
270
+
271
+ def __init__(self, video_id):
272
+ message = 'The provided cookie path is invalid'
273
+ super().__init__(video_id, message)
274
+
275
+
276
+ class CookiesInvalidError(TranscriptRetrievalError):
277
+ """
278
+ Exception raised when the provided cookies are invalid.
279
+
280
+ This exception is raised when the provided cookies are not valid or have expired.
281
+ It indicates that the application cannot authenticate with YouTube using the provided cookies.
282
+
283
+ Args:
284
+ video_id (str): The ID of the video for which the cookies are invalid.
285
+ """
286
+
287
+ def __init__(self, video_id):
288
+ message = 'The cookies provided are not valid (may have expired)'
289
+ super().__init__(video_id, message)
290
+
291
+
292
+ class FailedToCreateConsentCookieError(TranscriptRetrievalError):
293
+ """
294
+ Exception raised when consent cookie creation fails.
295
+
296
+ This exception is raised when the application fails to automatically give consent to saving cookies.
297
+ It indicates that the application cannot proceed without the consent cookie.
298
+
299
+ Args:
300
+ video_id (str): The ID of the video for which the consent cookie creation failed.
301
+ """
302
+
303
+ def __init__(self, video_id):
304
+ message = 'Failed to automatically give consent to saving cookies'
305
+ super().__init__(video_id, message)
306
+
307
+
308
+ class NoTranscriptFoundError(TranscriptRetrievalError):
309
+ """
310
+ Exception raised when no transcript is found for the requested language codes.
311
+
312
+ This exception is raised when no transcripts are found for any of the requested language codes.
313
+ It indicates that the application cannot retrieve transcripts for the requested languages.
314
+
315
+ Args:
316
+ video_id (str): The ID of the video for which no transcript was found.
317
+ requested_language_codes (list): The list of requested language codes.
318
+ transcript_data (dict): The transcript data that was found.
319
+ """
320
+
321
+ def __init__(self, video_id, requested_language_codes, transcript_data):
322
+ message = (
323
+ 'No transcripts were found for any of the requested language codes: {requested_language_codes}\n\n'
324
+ '{transcript_data}'
325
+ )
326
+ super().__init__(video_id, message.format(
327
+ requested_language_codes=requested_language_codes,
328
+ transcript_data=str(transcript_data)
329
329
  ))