myuniversaljobsmatch 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/myuniversaljobsmatch.rb +34 -12
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51b06cb74f5610ee5f670f9cc07b6a2092957dc5
|
4
|
+
data.tar.gz: a692634d9a195f1a00f0ec3c9d80b4392f861750
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79ca20c095f73204be96f10dd6b1d06d4c22ba62ebe016166adb10f77f0d29626f409a2f18d110584bb69d3f9ff1462847ef5fe56f1b321a3821dc5e85d8efbb
|
7
|
+
data.tar.gz: f119fd90a9442fc23b5dff218e1af3cd3cf5d86915e254538de711b7bbb6bb548721299afc08a90d3702063ad99bc9d2a3265e18e316c9555fd8a9a68ad983d2
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/myuniversaljobsmatch.rb
CHANGED
@@ -10,15 +10,21 @@ class MyUniversalJobsMatch
|
|
10
10
|
def initialize(filepath: '')
|
11
11
|
|
12
12
|
@filepath = filepath
|
13
|
+
@url_base = 'https://jobsearch.direct.gov.uk/'
|
14
|
+
|
15
|
+
@dx = Dynarex.new 'ujm[title,tags]/item(job_id, title, ' + \
|
16
|
+
'description, posting_date, company, location, industries, job_type)'
|
13
17
|
|
14
18
|
end
|
19
|
+
|
20
|
+
def dynarex()
|
21
|
+
@dx
|
22
|
+
end
|
15
23
|
|
16
24
|
def search(title: '', where: '')
|
17
25
|
|
18
|
-
|
19
|
-
|
20
|
-
"powersearch.aspx?qt=2&rad=20&tm=-1&where=#{where}" + \
|
21
|
-
"&tjt=#{title}"
|
26
|
+
url = @url_base + "jobsearch/powersearch.aspx?qt=2&rad=20&tm=-1&" + \
|
27
|
+
"where=#{where}&tjt=#{title}"
|
22
28
|
doc = Nokorexi.new(url).to_doc
|
23
29
|
|
24
30
|
table = doc.root.at_css('.JSresults')
|
@@ -27,30 +33,46 @@ class MyUniversalJobsMatch
|
|
27
33
|
# get the date
|
28
34
|
date = row.element('td/span/text()')
|
29
35
|
link = row.element('td[3]/a')
|
36
|
+
jobid = link.attributes[:href][/JobID=(\d+)/,1]
|
30
37
|
title = link.text
|
31
38
|
url = link.attributes[:href]
|
32
39
|
company = row.element('td[4]/span/text()')
|
33
40
|
location = row.element('td[5]/span/text()')
|
34
41
|
|
35
|
-
[date, title, url, company, location]
|
42
|
+
[jobid, date, title, url, company, location]
|
36
43
|
|
37
44
|
end
|
38
45
|
|
39
|
-
dx = Dynarex.new('vacancies[title, desc, date, time, tags, xslt]/
|
40
|
-
|
41
|
-
|
42
|
-
dx.default_key = 'uid'
|
46
|
+
dx = Dynarex.new('vacancies[title, desc, date, time, tags, xslt]/' + \
|
47
|
+
'vacancy(jobid, date, title, url, company, location, created_at)')
|
43
48
|
|
44
49
|
dx.title = "Universal Jobmatch jobs - Search results for '#{title}'"
|
45
|
-
dx.desc = "generated from web scrape of jobsearch.
|
50
|
+
dx.desc = "generated from web scrape of jobsearch." + \
|
51
|
+
"direct.gov.uk; source: " + url
|
46
52
|
dx.tags = 'jobs vacancies jobmatch ' + title.split.first
|
47
53
|
dx.date = Time.now.strftime("%Y-%b-%s")
|
48
54
|
dx.time = Time.now.strftime("%H:%M")
|
49
55
|
|
50
56
|
a.each do |row|
|
51
|
-
dx.create Hash[%i(date title url company location created_at)
|
57
|
+
dx.create Hash[%i(jobid date title url company location created_at).\
|
58
|
+
zip(row)]
|
52
59
|
end
|
53
60
|
|
54
61
|
return dx
|
55
62
|
end
|
56
|
-
|
63
|
+
|
64
|
+
def query(id)
|
65
|
+
|
66
|
+
url = @url_base + 'GetJob.aspx?JobID=' + id
|
67
|
+
doc = Nokorexi.new(url).to_doc
|
68
|
+
content = doc.root.at_css '.jobViewContent'
|
69
|
+
description = content.element('div')
|
70
|
+
|
71
|
+
raw_summary = doc.root.at_css('.jobViewSummary').xpath('dl/dd/text()')
|
72
|
+
job_id, posting_date, company, location, industries, job_type = raw_summary
|
73
|
+
|
74
|
+
fields = %i(job_id posting_date company location industries job_type description)
|
75
|
+
Hash[fields.zip(raw_summary + [description])]
|
76
|
+
|
77
|
+
end
|
78
|
+
end
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|