I want to extract the hyperlink from pptx, I know how to do it in word, but anyone knows how to extract it from pptx?
For example, I have a text below in pptx and I want to get the url https://stackoverflow.com/ :
Hello, stackoverflow
I tried to write the Python code to get the text:
from pptx import Presentation
from pptx.opc.constants import RELATIONSHIP_TYPE as RT
ppt = Presentation('data/ppt.pptx')
for i, sld in enumerate(ppt.slides, start=1):
print(f'-- {i} --')
for shp in sld.shapes:
if shp.has_text_frame:
print(shp.text)
But I just want to print the text and the URL when the text with hyperlink.