Skip to content

Instantly share code, notes, and snippets.

@framirez framirez/data_infosec.py
Last active Jan 24, 2018

Embed
What would you like to do?
infosec-conferences.py
import requests
from BeautifulSoup import BeautifulSoup
import csv
visit = {"2017": "https://infosec-conferences.com/events-in-2017", "2018": "https://infosec-conferences.com/"}
myFile = open('CONFERENCES.csv', 'w')
with myFile:
writer = csv.writer(myFile)
for year in visit:
r = requests.get(visit[year])
soup = BeautifulSoup(r.text)
ul = soup.findAll("ul", {"class":"list"})[0]
for li in ul.findAll('li'):
name = li.find("span", {"class": "name"})
if name:
address = li.find("span", {"itemprop": "address"})
location = address.find("span", {"itemprop": "addressLocality"})
region = address.find("span", {"itemprop": "addressRegion"})
country = address.find("span", {"itemprop": "addressCountry"})
date = li.find("span", {"itemprop": "startDate"})
if country and date:
writer.writerows([[year, (name.text).encode('utf-8').strip(), country.text, date["content"]]])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.