python包以获取使链接预览的元素
link_preview的Python项目详细描述
收集LinkPreview所需元素的Python模块。
概述
link_preview现在是社交媒体中共享链接的一种流行方式。 预览的内容是:-
1. og.title:- Title of the preview. In HTML: <meta property="og.title" content="XYZ"> Value: XYZ 2. og.description:- Description of the preview. In HTML: <meta property="og.description" content="XYZ"> Value: XYZ 3. og.image:- Image of the preview. In HTML: <meta property="og.image" content="XYZ"> Value: XYZ 4. title:- if 'og:title' is not found, this becomes the Title. In HTML: <title>XYZ</title> Value: XYZ 5. meta description:- if 'og:description' is not found, this becomes the Description. In HTML: <meta name="description" content="XYZ"> Value: XYZ 6. favicon:- if 'og:image' is not found, this becomes the Image. In HTML: <link rel="shortcut icon" href="XYZ" type="image/x-icon"> Value: XYZ 7. website:- Host website for the link.
引用:-richpreview(从 已学习)
此模块获取所有这些数据并将它们组合到字典中。
WhatsApp链接预览示例:-
####################################### # I # Title # # M # Description # # A # # # G # website # # E # # #######################################
用法:-
from link_preview import link_preview dict_elem = link_preview.generate_dict(url) # this is a dict() # Access values title = dict_elem['title'] description = dict_elem['description'] image = dict_elem['image'] website = dict_elem['website']
催化
要从pip安装,请使用以下命令
pip install link_preview
要更新,请使用
pip install -U link_preview
许可证
麻省理工学院