有没有办法从域中获取页面标题和 http 状态代码?

Is there any way to get the page title and http status code from just domain?

我正在尝试制作一个脚本,该脚本将从域中获取页面标题、HTTP 状态代码和 content-length。在网络上搜索后。我只找到了完全 url 的方法。我没有完整的 url。我有域(准确地说是子域)及其 ip。

如何使用 python 从域中获取页面标题、HTTP 状态代码和 content-length?

要构建 URL,请使用:

domain = 'example.com'
if domain.count('.') == 1:
    url = f'https://www.{domain}'
else:
    url = f'https://{domain}'

所以我一直在尝试它并找到了一个很棒的工具,它可以从域中获取完整的 url。它还可以获取 HTTP 状态、content-length、ip、标题等。 它被称为httpx https://github.com/projectdiscovery/httpx