We are pulling contact info from https://nbpa.com/agents/directory. There is no table on the page, but rather <div>s with <p> elements inside:
We can grab this element with:
agents_url <- "https://nbpa.com/agents/directory"
agents_page <- agents_url %>% read_html()
agents_page_elements <- agents_page %>% html_nodes('div.accordion-inner')
agents_page_elements[1]
agents_page_elements[1] %>% html_nodes('p')
We are looking to convert this into a 1-row dataframe:
Cell Email Professional Credentials:
(123) 456-7890 firstlast@email.com "NBA Certified Player Agent..."
Is this possible to do? The challenging part about this web scrape is that each accordion-inner div on the website has different p elements. Some have Cell: and Email:, others have Education:, Address:, etc. It varies by accordion-inner. If we can turn each individual node into a 1-row dataframe, we can then rbind all dataframes together using plyr::rbind.fill().
