please check this code :import requests from bs4 import BeautifulSoup url =…
- User
please check this code :import requests from bs4 import BeautifulSoup
url = "https://startup.jobs/?remote=true&c=Full-Time&q=machine+learning"
Make a GET request to fetch the raw HTML content
response = requests.get(url)
if response.status_code == 200: # Parse the HTML content soup = BeautifulSoup(response.text, 'html.parser') # Now you can work with the 'soup' object for further processing
# Find the search input element search_input = soup.find('input', {'type': 'search', 'name': 'query'}) # Find the remote checkbox remote_checkbox = soup.find('input', {'type': 'checkbox', 'name': 'remote'}) # Find the full-time checkbox full_time_checkbox = soup.find('input', {'type': 'checkbox', 'name': 'commitments[]', 'value': 'Full-Time'}) # Check if all elements are found before proceeding if search_input and remote_checkbox and full_time_checkbox: # Set the search query search_query = search_input.get('value') print("Search Query:", search_query) # Check if the remote checkbox is checked if 'checked' in remote_checkbox.attrs and remote_checkbox['checked'] == 'checked': print("Remote Checkbox is checked") # Check if the full-time checkbox is checked if 'checked' in full_time_checkbox.attrs and full_time_checkbox['checked'] == 'checked': print("Full-Time Checkbox is checked") # Find all job listings job_listings = soup.find_all('div', class_='job_listing') # Counter to keep track of printed jobs count = 0 # Iterate through job listings for job in job_listings: # Check if the job is machine learning, full time, and remote if 'machine learning' in job.text.lower() and 'full-time' in job.text.lower() and 'remote' in job.text.lower(): # Print job details print("\nJob Title:", job.find('h3', class_='job_listing-title').text.strip()) print("Company:", job.find('a', class_='company').text.strip()) print("Location:", job.find('span', class_='location').text.strip()) print("Link:", job.find('a', class_='job_listing-clickbox')['href']) print("-" * 30) # Increment the counter count += 1 # Break the loop after printing 10 jobs if count == 10: break # Inform if no matching jobs were found if count == 0: print("No jobs found matching the criteria.") else: print("One or more elements not found.")else: print("Failed to retrieve the page. Status code:", response.status_code)
- Assistant
- User
please update the code
- Assistant
- User
After runing this code it shows no jobs were found, but the jos are actually present on the website
- Assistant
- User
what will be a pth t my chromedriver
- Assistant
The path to your
chromedriveris the location where thechromedriverexecutable is saved on your computer. If you've already downloadedchromedriver, it would typically be in the location where you've saved it.For example:
- On Windows, if you downloaded
chromedriverand placed it inC:\Drivers, then your path would beC:\Drivers\chromedriver.exe. - On macOS or Linux, if you downloaded it to your home directory under a
driversfolder, your path might be/Users/yourusername/drivers/chromedriveron macOS or/home/yourusername/drivers/chromedriveron Linux.
The important thing is that you need to give the full path including the name of the executable ( on Windows or on macOS/Linux).
- On Windows, if you downloaded