Skip to content

Commit

Permalink
fix: Issue #539, the url may not be a valid url
Browse files Browse the repository at this point in the history
  • Loading branch information
qingchoulove committed Oct 23, 2024
1 parent b23a9d4 commit bd9b253
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ def is_webhook_enable(self) -> bool:

def should_handle(self, event: Event) -> bool:
parse_url = urlparse(event.source)
# Issue #539, the url may not be a valid url
if not parse_url:
return False
if parse_url.hostname.endswith('btbtt12.com') and 'attach-dialog-fid' in parse_url.path:
if parse_url.hostname and parse_url.hostname.endswith('btbtt12.com') and 'attach-dialog-fid' in parse_url.path:
logging.info('%s belongs to Btbtt12DisposableSourceProvider', event.source)
return True
return False
Expand Down
6 changes: 5 additions & 1 deletion kubespider/source_provider/magic_source_provider/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ def is_webhook_enable(self) -> bool:

def should_handle(self, event: Event) -> bool:
data_source_url = event.source
if urlparse(data_source_url).hostname in self.handle_host:
# Issue #539, the url may not be a valid url
parse_url = urlparse(data_source_url)
if not parse_url:
return False
if parse_url.hostname in self.handle_host:
logging.info('%s belongs to %s', data_source_url, self.provider_name)
return True
return False
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ def is_webhook_enable(self) -> bool:

def should_handle(self, event: Event) -> bool:
parse_url = urlparse(event.source)
# Issue #539, the url may not be a valid url
if not parse_url:
return False
if parse_url.hostname in ('www.youtube.com', 'youtube.com', 'm.youtube.com', 'youtu.be'):
logging.info('%s belongs to youtube_source_provider', event.source)
return True
Expand Down

0 comments on commit bd9b253

Please sign in to comment.