-
Notifications
You must be signed in to change notification settings - Fork 0
Development #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Development #33
Changes from all commits
56e44f8
82db2b0
579683d
fad6d1a
a12de82
5d79afe
0f3af89
d5d90f6
cbf5fcd
5a5d1d5
207ba9b
76b9912
366b640
ebc7bb7
be9a086
3fc9146
914b789
938886f
7737a2f
3ea0d45
ee4de2a
3ae0527
25dc303
730dc88
bb266bd
7d70a13
d1f450d
5436727
d8c850e
1405787
1ad53b1
3956aed
a0b1f82
a2d0cea
6adf5b1
57df8ef
6bbabff
7672520
d56e12e
5aca8cf
f0cb455
dd0ffab
4f534c8
9095db5
979acca
008f0e0
c09bdcc
1cb53f6
ee60426
56967e2
cfcf2dd
1aa6813
5844084
4a6a8e5
693bfbc
326928e
a80e583
69800d3
365ef8e
61d9dcf
046c52f
7b33d13
638fb4e
59a7722
4a09f0b
99b9642
15efb3c
6ca3832
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -9,13 +9,15 @@ | |||||
| from google.oauth2.credentials import Credentials | ||||||
| from googleapiclient.discovery import build | ||||||
| from googleapiclient.errors import HttpError | ||||||
| from google.auth.exceptions import RefreshError | ||||||
| YOUTUBE_AVAILABLE = True | ||||||
| except ImportError as e: | ||||||
| logger.error(f"Failed to import YouTube dependencies: {e}") | ||||||
| logger.info("Please install: pip install google-auth google-auth-oauthlib google-api-python-client") | ||||||
| YOUTUBE_AVAILABLE = False | ||||||
| Credentials = None # type: ignore | ||||||
| HttpError = Exception | ||||||
| RefreshError = Exception # type: ignore | ||||||
|
|
||||||
|
|
||||||
| class YouTubeListener: | ||||||
|
|
@@ -82,15 +84,20 @@ async def find_active_stream(self) -> bool: | |||||
| else: | ||||||
| logger.warning("No active live stream found for this channel") | ||||||
| return False | ||||||
| except RefreshError as e: | ||||||
| logger.error("YouTube authentication token has expired or been revoked") | ||||||
| logger.info("Please reconnect your YouTube account in settings to continue using YouTube chat integration") | ||||||
| return False | ||||||
| except HttpError as e: | ||||||
| status_code = getattr(e, 'resp', {}).get('status', 0) | ||||||
| if status_code == 401: | ||||||
| logger.error("YouTube API authentication error while finding active stream - token may be expired") | ||||||
| logger.error("YouTube API authentication error - token may be expired") | ||||||
| logger.info("Please reconnect your YouTube account in settings") | ||||||
| else: | ||||||
| logger.error(f"YouTube API error finding active stream: {e}") | ||||||
| return False | ||||||
| except Exception as e: | ||||||
| logger.error(f"Error finding active stream: {e}", exc_info=True) | ||||||
| logger.error(f"Error finding active stream: {e}") | ||||||
| return False | ||||||
|
|
||||||
| async def get_live_chat_id(self) -> Optional[str]: | ||||||
|
|
@@ -122,15 +129,20 @@ async def get_live_chat_id(self) -> Optional[str]: | |||||
| else: | ||||||
| logger.error(f"Video {self.video_id} not found") | ||||||
| return None | ||||||
| except RefreshError as e: | ||||||
| logger.error("YouTube authentication token has expired or been revoked") | ||||||
| logger.info("Please reconnect your YouTube account in settings to continue using YouTube chat integration") | ||||||
| return None | ||||||
| except HttpError as e: | ||||||
| status_code = getattr(e, 'resp', {}).get('status', 0) | ||||||
| if status_code == 401: | ||||||
| logger.error("YouTube API authentication error while getting live chat ID - token may be expired") | ||||||
| logger.error("YouTube API authentication error - token may be expired") | ||||||
| logger.info("Please reconnect your YouTube account in settings") | ||||||
| else: | ||||||
| logger.error(f"YouTube API error getting live chat ID: {e}") | ||||||
| return None | ||||||
| except Exception as e: | ||||||
| logger.error(f"Error getting live chat ID: {e}", exc_info=True) | ||||||
| logger.error(f"Error getting live chat ID: {e}") | ||||||
|
||||||
| logger.error(f"Error getting live chat ID: {e}") | |
| logger.error(f"Error getting live chat ID: {e}", exc_info=True) |
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -4,10 +4,24 @@ | |||
| """ | ||||
| import pytest | ||||
| import asyncio | ||||
| import os | ||||
|
||||
| import os |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,4 +3,4 @@ | |
| This file is automatically updated during CI/CD builds | ||
| """ | ||
|
|
||
| __version__ = "1.3.0" | ||
| __version__ = "1.3.1" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The removal of
exc_info=Truefrom this error log means the full traceback won't be logged. While this may reduce log clutter for expected errors, it could make debugging unexpected exceptions more difficult. Consider keepingexc_info=Truefor the catch-allExceptionhandler to help diagnose unforeseen issues, while omitting it for the specificRefreshErrorandHttpErrorhandlers where the error context is already clear.