blubbblülüllü
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import os, pymupdf
|
||||
|
||||
def read_files(path, output, filetypes=None):
|
||||
if filetypes is None:
|
||||
filetypes = ["pdf", "txt", "png", "jpg", "mp3"]
|
||||
|
||||
for root, dirs, files in os.walk(path):
|
||||
for file in files:
|
||||
if (file_type := file.split(".")[-1]) in filetypes:
|
||||
output.append((file_type, os.path.join(path, file)))
|
||||
|
||||
for folder in dirs:
|
||||
read_files(os.path.join(path, folder), output)
|
||||
|
||||
break
|
||||
|
||||
def extract_pdf_content(pdf_datei):
|
||||
doc = pymupdf.open(pdf_datei)
|
||||
a = ""
|
||||
for page in doc:
|
||||
a += page.get_text()
|
||||
return a
|
||||
Reference in New Issue
Block a user