LiamKhoaLe commited on
Commit
7626f3a
·
1 Parent(s): 05fffcb

Update web_reader_url

Browse files
app/.DS_Store CHANGED
Binary files a/app/.DS_Store and b/app/.DS_Store differ
 
app/routers/import_doc.py CHANGED
@@ -37,8 +37,7 @@ async def import_book(req: ImportRequest):
37
  print(f"[INFO] No download URL. Viewability: {result.get('viewability', 'N/A')}")
38
  raise HTTPException(403, "Download not permitted")
39
 
40
-
41
-
42
  download_url = result["download_url"]
43
  file_path = f"/tmp/{req.candidate_id}.pdf"
44
 
 
37
  print(f"[INFO] No download URL. Viewability: {result.get('viewability', 'N/A')}")
38
  raise HTTPException(403, "Download not permitted")
39
 
40
+ # Write temp file and save as Pdf from downloadable link
 
41
  download_url = result["download_url"]
42
  file_path = f"/tmp/{req.candidate_id}.pdf"
43
 
app/services/google_books.py CHANGED
@@ -18,7 +18,8 @@ async def search(q):
18
  "download_available": False, # Google Books rarely allows this
19
  "download_url": None,
20
  "ref": {"id": b["id"]},
21
- "web_reader_url": b["accessInfo"].get("webReaderLink"),
 
22
  "viewability": b["accessInfo"]["viewability"],
23
  } for b in data
24
  ]
 
18
  "download_available": False, # Google Books rarely allows this
19
  "download_url": None,
20
  "ref": {"id": b["id"]},
21
+ # "web_reader_url": b["accessInfo"].get("webReaderLink"), # Access site, not always available
22
+ "web_reader_url": f"https://books.google.com/books/about?id={b['id']}&redir_esc=y", # Info site, easy visible
23
  "viewability": b["accessInfo"]["viewability"],
24
  } for b in data
25
  ]