html - 如何将图标预览添加到谷歌商店应用程序的 html 列表中?
问题描述
基本上我有一个 html 文件中的谷歌应用程序链接列表,我希望这些链接显示链接的应用程序的预览(无需搜索,然后手动添加每个应用程序的图像/图标 url)。可能吗?
<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 文件中,也可以手动复制它。
推荐阅读
- spring - 休眠中的createalias两次加入父表
- java - 如何使用 DOM 解析大型 xml 文档?
- laravel - laravel API,不从数据库中获取数据
- javascript - 有没有办法找到添加到主屏幕 - 应用程序图标是否已使用 Javascript 添加到主屏幕?
- apache - Ubuntu 上的 Apache:模块 dav_module 已加载
- php - PHP获取复选框值以逗号分隔
- reactjs - 除非刷新页面,否则 React 可加载无法在每个新构建上加载组件
- javascript - VueJS:数据未更新
- mysql - 在子查询中获取最大输入日期
- r - R 中是否有符号 ODE 求解器?(ODE = 常微分方程)