Created
November 1, 2023 13:07
-
-
Save nopium/002f59ffb7ec2a3afcc29a3b87622a90 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # pip install selenium bs4 | |
| url = 'https://www.amphenol-cs.com/millipacs-10127112102lf.html' | |
| from bs4 import BeautifulSoup | |
| from selenium import webdriver | |
| from selenium.webdriver import ChromeOptions | |
| options = webdriver.ChromeOptions() | |
| options.add_argument('--headless=new') | |
| options.add_argument('--disable-gpu') | |
| options.add_argument("--window-size=1920,1080") | |
| options.add_argument('user-agent=Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36') | |
| driver = webdriver.Chrome(options) | |
| driver.get(url) | |
| html_content = driver.page_source | |
| soup = BeautifulSoup(html_content, 'html.parser') | |
| desc = soup.find('div', class_='full-desc') | |
| if desc: | |
| print( desc.contents[0] ) | |
| else: | |
| print( 'Fail' ) | |
| driver.quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment