无法从存档中解析原始URL

问题描述 投票:0回答:1

我写信给你是因为

我想从存档中获取原始 URL。我尝试了不同的 Python 库,但无法解析存档链接示例 https://archive.ph/kEOqK

url="https://archive.ph/kEOqK"
import requests
from bs4 import BeautifulSoup
response = requests.get(url)
soup = BeautifulSoup(response.text, 'html.parser')

错误

Connection error occurred: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
Failed to parse the page.

有没有办法从存档快照中获取原始URL?

python url beautifulsoup python-requests archive
1个回答
0
投票
from http.client import HTTPSConnection

cnxn=HTTPSConnection("archive.ph")

cnxn.request('GET','/kE0qK')

response=cnxn.getresponse()

print(response.status)

headers=response.getheaders()

print(headers)

# print(response.read())

cnxn.close()

现在尝试在标题列表中找到标题

Location
。这是第一个重定向的网址。

© www.soinside.com 2019 - 2024. All rights reserved.