You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1006 B
Python
49 lines
1006 B
Python
import DuckDuckGoImages as ddg
|
|
from duckduckgo_images_api import search
|
|
import os
|
|
import shutil
|
|
|
|
with open('speech.txt','r') as speech:
|
|
qq = speech.readlines()
|
|
|
|
html = ''
|
|
|
|
html = '''
|
|
<html>
|
|
<head>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<link rel="stylesheet" href="pagedjs_files/interface.css">
|
|
<script src="pagedjs_files/paged.polyfill.js"></script>
|
|
<link rel="stylesheet" href="styles/3.css">
|
|
<meta charset="utf-8"/>
|
|
<title>Booklet</title>
|
|
</head>
|
|
<body>
|
|
'''
|
|
|
|
|
|
|
|
for q in qq:
|
|
q = q.strip()
|
|
if q == '''<span class="interim"></span>''':
|
|
continue
|
|
|
|
q = q.replace("\n","")
|
|
|
|
qDDG = q.replace(' ','+')
|
|
|
|
results = search(q, max_results=1)
|
|
r = results["results"][0]["thumbnail"]
|
|
|
|
html += f"""<span> {q} </span>\n"""
|
|
html += f"""<img src='{r}'>\n"""
|
|
|
|
|
|
|
|
html += '''</body>
|
|
</html>'''
|
|
|
|
html = html.replace(' .','.').replace(" '", "'")
|
|
|
|
with open('nuovo.html','w') as index:
|
|
index.write(html) |