Ramesh-vani commited on
Commit
0037043
·
verified ·
1 Parent(s): b9f6afe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -51,11 +51,11 @@ def inline_resources(soup, base_url):
51
 
52
  return soup
53
 
54
- async def send_html_chunks(websocket, html):
55
- chunk_size = 1024 # Define your chunk size here
56
- for i in range(0, len(html), chunk_size):
57
- chunk = html[i:i + chunk_size]
58
- await websocket.send(chunk)
59
  await asyncio.sleep(0.1) # Add a small delay if needed
60
 
61
  # async def send_html_chunks(ws, html_data, chunk_size=1024):
 
51
 
52
  return soup
53
 
54
+ async def send_html_chunks(websocket, soup):
55
+ for tag in soup.descendants:
56
+ if isinstance(tag, str):
57
+ continue
58
+ await websocket.send(str(tag))
59
  await asyncio.sleep(0.1) # Add a small delay if needed
60
 
61
  # async def send_html_chunks(ws, html_data, chunk_size=1024):