Looking to pick out specific data from a website such as prices, company info etc. Luckily, the website designer has put lots of tags such as
<!-- Begin Services Table -->
' desired data
<!-- End Services Table -->
What kind of code would I need in order for BS4 to return the strings between the given tags?
import requests
from bs4 import BeautifulSoup
url = "http://www.100ll.com/searchresults.phpclear_previous=true&searchfor="+'KPLN'+"&submit.x=0&submit.y=0"
response = requests.get(url)
soup = BeautifulSoup(response.content, "lxml")
text_list = soup.find(id="framediv").find_all(text=True)
start_index = text_list.index(' Begin Fuel Information Table ') + 1
end_index = text_list.index(' End Fuel Information Table ')
for item in text_list[start_index:end_index]:
print(item)
Here's the website in question:
http://www.100ll.com/showfbo.php?HashID=cf5f18404c062da6fa11e3af41358873
See Question&Answers more detail:os