fw1zr commited on
Commit
ab62813
1 Parent(s): 698a8e8

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. utils.py +7 -6
utils.py CHANGED
@@ -5,12 +5,13 @@ import requests
5
 
6
  def extract_instagram_code(url: str) -> str:
7
  parts = [part for part in url.split('/') if part and '?' not in part]
8
- # The post code is expected to be the part after 'p'
9
- if 'p' in parts:
10
- post_code_index = parts.index('p') + 1
11
- if post_code_index < len(parts):
12
- return parts[post_code_index]
13
- return "Invalid URL or post code not found"
 
14
 
15
 
16
  def get_users_from_keyword(keyword: str):
 
5
 
6
  def extract_instagram_code(url: str) -> str:
7
  parts = [part for part in url.split('/') if part and '?' not in part]
8
+ # The code is expected to be the part after 'p' or 'reel'
9
+ for key in ['p', 'reel']:
10
+ if key in parts:
11
+ code_index = parts.index(key) + 1
12
+ if code_index < len(parts):
13
+ return parts[code_index]
14
+ return "Invalid URL or code not found"
15
 
16
 
17
  def get_users_from_keyword(keyword: str):