Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added wikicfp crawler #183

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions crawlers/wikicfp/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

83 changes: 83 additions & 0 deletions crawlers/wikicfp/wikicfp_crawler.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# -*- coding: utf-8 -*-

import datetime as dt

import json
import requests
from bs4 import BeautifulSoup as bs

from ..base import BaseCrawler

class WikicfpCrawler(BaseCrawler):
def get_events(self):
response = requests.get(
"http://www.wikicfp.com/cfp/"
)
response.encoding = 'utf-8'
soup = bs(response.content, 'html.parser')
table = soup.find_all('div', class_='contsec')[2].form.table
rows = table.find_all('tr')[5:]

for i in range(0, len(rows), 2):

top_row = rows[i].find_all('td')
url = 'http://www.wikicfp.com' + top_row[0].a['href']
name = top_row[1].text
bottom_row = rows[i+1].find_all('td')
date = bottom_row[0].text
location = bottom_row[1].text

city = state = country = None
if ',' in location:
location_parsed = bottom_row[1].text.split(', ')
print(location_parsed)
// special cases
if 'University' in location_parsed[0]:
city = location_parsed[1]
elif len(location_parsed) == 3:
city, state, country = location_parsed
elif len(location_parsed) == 2:
city, country = location_parsed

if '-' in date:
start_date, end_date = date.split(' - ')
print(start_date)
print(end_date)

s_cfp_end_date = bottom_row[2].text
// special cases
index = bottom_row[2].text.find('(')
if index != -1:
s_cfp_end_date = s_cfp_end_date[index+1: -1]

cfp_end_date = dt.datetime.strptime(s_cfp_end_date, "%b %d, %Y")
print(cfp_end_date)
cfp_open = (
True
if dt.datetime.now() < cfp_end_date
else False
)

source = "http://www.wikicfp.com/cfp/"
tags = 'technology'
kind = 'conference'
by = 'N/A'

e = {
"name": name,
"url": url,
"city": city,
"state": state,
"country": country,
"location": location,
"cfp_open": cfp_open,
"cfp_end_date": cfp_end_date,
"start_date": start_date,
"end_date": end_date,
"source": source,
"tags": tags,
"kind": kind,
"by": by,
}

self.events.append(e)