'BeautifulSoup cannot find table by id
I would like to scrape the table with 'tbQuote' id in the site. Yet, the table return None and I cannot find the table id in the soup. I don't know which part is wrong. Thank you for your help
from bs4 import BeautifulSoup
from urllib.request
import urlopen, Request
site = "http://www.aastocks.com/en/stocks/quote/detail-quote.aspx?symbol=00002"
hdr = {'User-Agent': 'Mozilla/5.0'}
req = Request(site, headers=hdr)
res = urlopen(req)
rawpage = res.read().decode("utf-8")
soup = BeautifulSoup(rawpage, "html.parser")
table = soup.find("table", id="tbQuote")
print(table)
Solution 1:[1]
Im not sure which field is the default mongodb key in your example, but here is how you can solve it, just make sure which once is correct for you _id or id. Also, I've hardcoded the stings
User.findOne({_id: 's654fs54s6d4f'})
.select({
SubCats: {
$elemMatch: {_id: 'jhgfsf68746'}
}
})
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
