我想在Wiki中获得特定语言的文章。
我尝试了以下代码:
URL = "https://en.wikipedia.org/w/api.php"
PARAMS = {
"action": "query",
"titles": "Python",
"prop": "langlinks",
"lllang": "de",
"format": "json"
}
results = requests.get(url=URL, params=PARAMS)
soup = BeautifulSoup(results.content, 'html.parser')
print(soup.prettify())
但是我并没有得到整篇文章,这是我的全部
{"batchcomplete":"","query":{"pages":{"46332325":{"pageid":46332325,"ns":0,"title":"Python","langlinks":[{"lang":"de","*":"Python"}]}}}}
您能帮助您了解我做错了什么吗?
将URL更改为de.wikipedia.org
以获取德语版本。