Mar-25-2020, 08:36 PM
(Mar-24-2020, 02:41 PM)snippsat Wrote: Yes have something to look into and learn,the problem is that you choose not so easy task start with.
Also when struggle with the basic fundamentals of Python,then is not so easy
So to show a demo on how to start,as this site has some challenges.
The description info is generated bye JavaScript,so need to use Selenium.
Need to first click onexpand all
to activate all data.
Then can parse name and a value as test.
from selenium import webdriver from selenium.webdriver.chrome.options import Options from selenium.webdriver.common.keys import Keys from bs4 import BeautifulSoup import time #--| Setup options = Options() options.add_argument("--headless") options.add_argument("--window-size=1980,1020") browser = webdriver.Chrome(executable_path=r'chromedriver.exe', options=options) #--| Parse or automation url = 'http://www.snoco.org/app/corrections/jailregister/dailyBookingRegister.aspx' browser.get(url) soup = BeautifulSoup(browser.page_source, 'lxml') expan = browser.find_elements_by_css_selector('#expandAll') expan[0].click() name = soup.select_one('#bookingName1') # Use BS charge_description = browser.find_elements_by_css_selector('#booking1 > p > table > tbody > tr:nth-child(2) > td:nth-child(1)') # Use Sel print(name.text) print(charge_description[0].text)
Output:ALFORD, CALEB AARON PAROLE VIOLATION
snippsat,
Thank you sir for a great starting point with my tasks and challenges set before me with complicated not beginner python projects. You have given me lots of information between this thread and the other which I believe will set me in the right direction.
Upon making progress I will update the threads accordingly!
Best Regards and God Bless,
Brandon Kastning
“And one of the elders saith unto me, Weep not: behold, the Lion of the tribe of Juda, the Root of David, hath prevailed to open the book,...” - Revelation 5:5 (KJV)
“And oppress not the widow, nor the fatherless, the stranger, nor the poor; and ...” - Zechariah 7:10 (KJV)
#LetHISPeopleGo
“And oppress not the widow, nor the fatherless, the stranger, nor the poor; and ...” - Zechariah 7:10 (KJV)
#LetHISPeopleGo