[英]scraping data from web page but missing content
I am downloading the verb conjugations to aid my learning.我正在下载动词变位以帮助我的学习。 However one thing I can't seem to get from this web page is the english translation near the top of the page.
然而,我似乎无法从该网页获得的一件事是靠近页面顶部的英文翻译。
The code I have is below.我的代码如下。 When I print results_eng it prints the section I want but there is no english translation, what am I missing?
当我打印 results_eng 时,它会打印我想要的部分,但没有英文翻译,我错过了什么?
import requests
from bs4 import BeautifulSoup
URL = 'https://conjugator.reverso.net/conjugation-portuguese-verb-ser.html'
page = requests.get(URL)
soup = BeautifulSoup(page.content, 'html.parser')
results_eng = soup.find(id='list-translations')
eng = results_eng.find_all('p', class_='context_term')
In a normal website, you should be able to find the text in a paragraph witht the function get_text()
, but in this case this is a search, wich means it's probably pulling the data from a database and its not in the paragraph itself.在普通网站中,您应该能够使用函数
get_text()
找到段落中的文本,但在这种情况下,这是一个搜索,这意味着它可能从数据库中提取数据,而不是在段落本身中。 At least that's what I can come up with, since I tried to use that function and I got an empty string in return.至少这是我能想到的,因为我试图使用该函数,但我得到了一个空字符串作为回报。 Can't you try another website and see what happens?
你不能尝试另一个网站,看看会发生什么?
pd: I'm a beginner, sorry if I'm guessing wrong pd:我是初学者,如果我猜错了,抱歉
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.