我写信给你是因为
我想从存档中获取原始 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?
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
。这是第一个重定向的网址。