Chrunos commited on
Commit
51a907c
·
verified ·
1 Parent(s): d61ba9f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -46,11 +46,11 @@ class DownloadResponse(BaseModel):
46
  def extract_shortcode(url: str) -> str:
47
  """Extract Instagram post shortcode from URL"""
48
  url = url.strip()
49
- parts = url.split('/')
50
-
51
- if 'instagram.com' not in parts:
52
  raise ValueError("Invalid Instagram URL")
53
 
 
54
  for i, part in enumerate(parts):
55
  if part in ['p', 'reel', 'tv'] and (i+1) < len(parts):
56
  shortcode = parts[i+1].split('?')[0]
@@ -120,8 +120,6 @@ async def download_post(request: PostRequest):
120
  return {"download_url": download_url}
121
 
122
 
123
-
124
-
125
  @app.get("/api/health")
126
  async def health_check():
127
- return {"status": "healthy"}
 
46
  def extract_shortcode(url: str) -> str:
47
  """Extract Instagram post shortcode from URL"""
48
  url = url.strip()
49
+ # Correct the check for 'instagram.com'
50
+ if 'instagram.com' not in url:
 
51
  raise ValueError("Invalid Instagram URL")
52
 
53
+ parts = url.split('/')
54
  for i, part in enumerate(parts):
55
  if part in ['p', 'reel', 'tv'] and (i+1) < len(parts):
56
  shortcode = parts[i+1].split('?')[0]
 
120
  return {"download_url": download_url}
121
 
122
 
 
 
123
  @app.get("/api/health")
124
  async def health_check():
125
+ return {"status": "healthy"}