jonathanjordan21 commited on
Commit
f48a877
·
verified ·
1 Parent(s): 1a19e7b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -0
app.py CHANGED
@@ -176,6 +176,9 @@ async def ig_post_detail(post_id: Optional[str] = None, url: Optional[str] = Non
176
  async def fb_post_detail(username: Optional[str] = None, post_id: Optional[str] = None, url: Optional[str] = None):
177
  if not url:
178
  url = f"https://www.facebook.com/{username}/posts/{post_id}"
 
 
 
179
  user_agent = "Googlebot"
180
 
181
  res = requests.get(
@@ -314,6 +317,8 @@ async def tiktok_video_details(username: Optional[str] = None, video_id:Optional
314
  if username[0] != "@":
315
  username = "@" + username
316
  url = f"https://www.tiktok.com/{username}/video/{video_id}"
 
 
317
 
318
  # user_agent = "LinkedInBot"
319
  user_agent = "Mozilla/5.0 (compatible; YandexBot/3.0; +http://yandex.com/bots)"
 
176
  async def fb_post_detail(username: Optional[str] = None, post_id: Optional[str] = None, url: Optional[str] = None):
177
  if not url:
178
  url = f"https://www.facebook.com/{username}/posts/{post_id}"
179
+ else:
180
+ username = url.split("//www.facebook.com/",1)[-1].split("/",1)[0]
181
+
182
  user_agent = "Googlebot"
183
 
184
  res = requests.get(
 
317
  if username[0] != "@":
318
  username = "@" + username
319
  url = f"https://www.tiktok.com/{username}/video/{video_id}"
320
+ else:
321
+ username = url.split("//www.tiktok.com/",1)[-1].split("/")[0]
322
 
323
  # user_agent = "LinkedInBot"
324
  user_agent = "Mozilla/5.0 (compatible; YandexBot/3.0; +http://yandex.com/bots)"