Python获取URL HTML时出现Error 410(资源已不可用)问题求助
Got it, let's work through this 410 "resource no longer available" error you're facing. That status code means the exact URL you're targeting has been permanently removed from AustLII's server—so we need to adjust our approach to get that case document. Here are a few actionable solutions:
1. Retrieve the archived version via the Wayback Machine
The Internet Archive's Wayback Machine often saves snapshots of old web pages, including AustLII case documents. You can use it to pull a historical copy of the page:
First, visit the Wayback Machine, input your original URL, and pick a snapshot date where the page was still active (you’ll see a calendar with available dates marked). Then update your code to use the archived URL, like this:
import requests from bs4 import BeautifulSoup # Replace the date in the URL with a valid snapshot date from the Wayback Machine archived_url = "https://web.archive.org/web/20220101000000/http://www8.austlii.edu.au/cgi-bin/viewdoc/au/cases/cth/FCA/2006/3.html" response = requests.get(archived_url) if response.status_code == 200: soup = BeautifulSoup(response.text, 'html.parser') # Process the archived HTML content here print("Successfully fetched archived case document") else: print(f"Couldn't access archive: Status code {response.status_code}")
2. Locate the case's new URL on AustLII
AustLII occasionally restructures their URL paths. Since your target is [2006] FCA 3 (Federal Court of Australia Case 3, 2006), try these steps to find the current valid URL:
- Navigate to AustLII's Federal Court of Australia cases section
- Use the search bar to look up "[2006] FCA 3" (include the brackets for precise results)
- Once you find the case page, copy its new URL and replace it in your original requests code.
3. Check AustLII's case list archives
If the search doesn’t turn it up, browse AustLII’s 2006 Federal Court case list. Look for entries labeled "[2006] FCA 3"—the linked page will have the correct current URL you can use.
内容的提问来源于stack exchange,提问作者marisa

