BuffIO to read PDF COntent
This commit is contained in:
@@ -2,6 +2,7 @@ import nextcord as nc
|
|||||||
from nextcord.ext import commands
|
from nextcord.ext import commands
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
import asyncio
|
import asyncio
|
||||||
|
import io
|
||||||
import os
|
import os
|
||||||
import requests as req
|
import requests as req
|
||||||
from bs4 import BeautifulSoup as soup
|
from bs4 import BeautifulSoup as soup
|
||||||
@@ -30,7 +31,7 @@ async def search(txt):
|
|||||||
|
|
||||||
async def getPDF(url):
|
async def getPDF(url):
|
||||||
resp = req.get(url, stream=True)
|
resp = req.get(url, stream=True)
|
||||||
pdf = resp.content
|
pdf = io.BytesIO(resp.content)
|
||||||
pages = pdftotext.PDF(pdf)
|
pages = pdftotext.PDF(pdf)
|
||||||
return "\n\n".join(pages)
|
return "\n\n".join(pages)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user