Search
Monday, April 28, 2025
Pyhton code here..share your commetns
import requests
from bs4 import BeautifulSoup
import pandas as pd
# Define the URL you want to scrape
url = 'https://COMPXXXX.COM' # Replace with the target website
# Send a GET request to fetch the webpage
response = requests.get(url)
# Check if the request was successful (status code 200)
if response.status_code == 200:
soup = BeautifulSoup(response.content, 'html.parser')
# Find the relevant HTML elements containing the data
attendees = []
# Example: Let's assume attendees are stored in <div class="attendee">
for attendee in soup.find_all('div', class_='attendee'):
name = attendee.find('span', class_='name').text.strip()
job_title = attendee.find('span', class_='job-title').text.strip()
company_name = attendee.find('span', class_='company-name').text.strip()
company_activity = attendee.find('span', class_='company-activity').text.strip()
attendees.append({
'Name': name,
'Job Title': job_title,
'Company Name': company_name,
'Company Activity': company_activity
})
# Convert the list of dictionaries to a DataFrame for easy manipulation
df = pd.DataFrame(attendees)
# Save the data to a CSV file
df.to_csv('attendees.csv', index=False)
print("Scraping successful! Data saved to 'attendees.csv'")
else:
print("Failed to retrieve the webpage. Status code:", response.status_code)