jonathanjordan21 commited on
Commit
681d84b
·
verified ·
1 Parent(s): ba72bad

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -10,7 +10,8 @@ app = FastAPI()
10
 
11
  @app.get("/tiktok_details/")
12
  async def read_item(username: str, video_id:str):
13
- user_agent = "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; Googlebot/2.1; +http://www.google.com/bot.html) Chrome/W.X.Y.Z Safari/537.36"
 
14
  # if "https:" in link_detail:
15
  # url = link_detail
16
  # elif link_detail[0] == "/":
@@ -20,7 +21,7 @@ async def read_item(username: str, video_id:str):
20
 
21
  url = f"https://www.tiktok.com/@{username}/video/{video_id}"
22
 
23
- res = requests.get(url, headers={"User-Agent":user_agent})
24
  text_maker = html2text.HTML2Text()
25
  text_maker.ignore_links = True
26
  text_maker.ignore_images = True
 
10
 
11
  @app.get("/tiktok_details/")
12
  async def read_item(username: str, video_id:str):
13
+ # user_agent = "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; Googlebot/2.1; +http://www.google.com/bot.html) Chrome/W.X.Y.Z Safari/537.36"
14
+ user_agent = "Googlebot/2.1"
15
  # if "https:" in link_detail:
16
  # url = link_detail
17
  # elif link_detail[0] == "/":
 
21
 
22
  url = f"https://www.tiktok.com/@{username}/video/{video_id}"
23
 
24
+ res = requests.get(url, headers={"user-agent":user_agent})
25
  text_maker = html2text.HTML2Text()
26
  text_maker.ignore_links = True
27
  text_maker.ignore_images = True