如何将图标预览添加到谷歌商店应用程序的 html 列表中?



基本上,我在html文件中有一个google应用程序链接列表,我希望这些链接显示链接的应用程序的预览(无需搜索然后手动添加图像/图标网址,对于每个应用程序(。可能吗?


<html><body>
<ul>
<li> <a href="https://play.google.com/store/apps/details?id=com.adobe.reader">Adobe Acrobat</a> 
</li>
<li> <a href="https://play.google.com/store/apps/details?id=org.mozilla.firefox">Firefox</a> 
</li>
</ul>
</body></html>

使用 python,您可以在页面的元标记中抓取社交媒体图像预览。

import urllib.request
from bs4 import BeautifulSoup
page = urllib.request.urlopen('https://play.google.com/store/apps/details?id=com.adobe.reader')
html = BeautifulSoup(page.read(), "html.parser")
for tags in html.find_all('meta'):
if tags.get("property") == "og:image":
print(tags.get("content"))

这将返回一个指向图像的链接,您可以将其导入到html文件,也可以手动复制它。

最新更新