-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from NathanWorkman/feature/indeed
Indeed mvp
- Loading branch information
Showing
3 changed files
with
49 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from scrapy.utils.project import get_project_settings | ||
from scrapy.crawler import CrawlerProcess | ||
|
||
setting = get_project_settings() | ||
process = CrawlerProcess(setting) | ||
# https://doc.scrapy.org/en/latest/topics/api.html#scrapy.crawler.CrawlerProcess | ||
|
||
for spider in process.spiders.list(): | ||
print("Running spider %s" % (spider)) | ||
process.crawl(spider) | ||
|
||
process.start() |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from scrapy.spiders import XMLFeedSpider | ||
from scraper.items import JobItem | ||
|
||
from django.utils import timezone | ||
|
||
|
||
class IndeedSpider(XMLFeedSpider): | ||
name = 'indeed' | ||
allowed_domains = ['indeed.com'] | ||
start_urls = ['http://rss.indeed.com/rss?q=django&l=remote'] | ||
iterator = 'iternodes' # This is actually unnecessary, since it's the default value | ||
itertag = 'item' | ||
|
||
def parse_node(self, response, node): | ||
item = JobItem() | ||
item['title'] = node.xpath('title/text()').extract_first() | ||
item['company'] = node.xpath('source/text()').extract_first() | ||
item['body'] = node.xpath('description/text()').extract() | ||
item['pub_date'] = node.xpath('pubDate/text()').extract_first() | ||
item['url'] = node.xpath('link/text()').extract_first() | ||
item["scrape_date"] = timezone.now() | ||
item["job_board"] = "Indeed" | ||
item["board_url"] = "www.indeed.com" | ||
item["email"] = str('n/a') | ||
item["salary"] = str('n/a') | ||
item['location'] = str('n/a') | ||
return item |