acecalisto3 commited on
Commit
e9abd76
·
verified ·
1 Parent(s): 4da78ca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -95,18 +95,19 @@ class URLProcessor:
95
  except Exception as e:
96
  logger.error(f"Content fetch failed: {e}")
97
  return None
98
-
99
  def _handle_google_drive(self, url: str) -> Optional[Dict]:
100
  """Process Google Drive file links"""
101
- try: file_id = re.search(r'/file/d/([a-zA-Z0-9_-]+)', url)
 
102
  if not file_id:
103
  logger.error(f"Invalid Google Drive URL: {url}")
104
  return None
105
-
106
  direct_url = f"https://drive.google.com/uc?export=download&id={file_id.group(1)}"
107
  response = self.session.get(direct_url, timeout=self.timeout)
108
  response.raise_for_status()
109
-
110
  return {
111
  'content': response.text,
112
  'content_type': response.headers.get('Content-Type', ''),
@@ -115,7 +116,7 @@ class URLProcessor:
115
  except Exception as e:
116
  logger.error(f"Google Drive processing failed: {e}")
117
  return None
118
-
119
  def _handle_google_calendar(self, url: str) -> Optional[Dict]:
120
  """Process Google Calendar ICS feeds"""
121
  try:
 
95
  except Exception as e:
96
  logger.error(f"Content fetch failed: {e}")
97
  return None
98
+
99
  def _handle_google_drive(self, url: str) -> Optional[Dict]:
100
  """Process Google Drive file links"""
101
+ try:
102
+ file_id = re.search(r'/file/d/([a-zA-Z0-9_-]+)', url)
103
  if not file_id:
104
  logger.error(f"Invalid Google Drive URL: {url}")
105
  return None
106
+
107
  direct_url = f"https://drive.google.com/uc?export=download&id={file_id.group(1)}"
108
  response = self.session.get(direct_url, timeout=self.timeout)
109
  response.raise_for_status()
110
+
111
  return {
112
  'content': response.text,
113
  'content_type': response.headers.get('Content-Type', ''),
 
116
  except Exception as e:
117
  logger.error(f"Google Drive processing failed: {e}")
118
  return None
119
+
120
  def _handle_google_calendar(self, url: str) -> Optional[Dict]:
121
  """Process Google Calendar ICS feeds"""
122
  try: