adops_report_scrapper 0.1.33 → 0.1.34
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +3 -0
- data/lib/adops_report_scrapper/triplelift_client.rb +23 -50
- data/lib/adops_report_scrapper/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1ae6fd211544a7d662b49b8b113ccb60f6b7059
|
4
|
+
data.tar.gz: 57496565cbfbcbcc81650262ec83d8151768c3bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5cc4e0d71edf0ec341d493f0b7193eed9ee8105260dc8a52f60b59c725ea3beaeb8a9158084ce4fbdc3148b686d68718ab2ae6b51a5a1e00c1af52bd3680f1e
|
7
|
+
data.tar.gz: 17a4db37edc2203ad9c830dbc0fa9c918d86a528749abfb3279609a63a8d9e4ff900840d3459b24cb5a4277fd13fb8e84122ac8f0dacfae18d5f8b5640254f7f
|
data/CHANGELOG
CHANGED
@@ -20,61 +20,34 @@ class AdopsReportScrapper::TripleliftClient < AdopsReportScrapper::BaseClient
|
|
20
20
|
@date_str = @date.strftime('%B %d, %Y')
|
21
21
|
@client.find(:xpath, '//*[text()="Reporting"]').click
|
22
22
|
wait_for_spin
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
23
|
+
@client.find(:xpath, '//button[contains(text(),"Last 7 days")]').click
|
24
|
+
@client.find(:xpath, '//a[contains(text(),"Yesterday")]').click
|
25
|
+
sleep 1
|
28
26
|
|
29
|
-
@client.find(:xpath, '//
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
@client.find(:xpath, '
|
34
|
-
|
35
|
-
while @publishers.count > 0
|
36
|
-
extract_data(@publishers.shift)
|
37
|
-
end
|
38
|
-
end
|
27
|
+
@client.find(:xpath, '//tl-checkbox/div/span[text()[normalize-space()="Placement"]]').click
|
28
|
+
sleep 1
|
29
|
+
@client.find(:xpath, '//tl-checkbox/div/span[text()[normalize-space()="Clicks"]]').click
|
30
|
+
sleep 1
|
31
|
+
@client.find(:xpath, '//*[text()[normalize-space()="Run query"]]').click
|
32
|
+
sleep 10
|
39
33
|
|
40
|
-
|
41
|
-
|
42
|
-
@client.find(:xpath, '//*[text()="Reporting"]').click
|
43
|
-
sleep 2
|
44
|
-
@client.find(:xpath, '//button[../../div[contains(text(),"Publisher")]]').click
|
45
|
-
index = -1 - @publishers.count(publisher)
|
46
|
-
sleep 1
|
47
|
-
@client.find_all(:xpath, "//*[text()=\"#{publisher}\"]")[index].click
|
48
|
-
wait_for_spin
|
49
|
-
|
50
|
-
return if @client.find_all(:xpath, '//*[text()="No data available for selected date range"]').count > 0
|
51
|
-
|
52
|
-
@client.find(:xpath, '//*[@model="startDate"]//input').set @date_str
|
53
|
-
sleep 1
|
54
|
-
@client.find(:xpath, '//*[@model="endDate"]//input').set @date_str
|
55
|
-
sleep 1
|
56
|
-
@client.find(:xpath, '//button[../../div[contains(text(),"Group by")]]').click
|
57
|
-
@client.find(:xpath, '//*[text()="Date and Placement"]').click
|
58
|
-
wait_for_spin
|
34
|
+
extract_data
|
35
|
+
end
|
59
36
|
|
60
|
-
|
37
|
+
def extract_data
|
38
|
+
@data = []
|
39
|
+
return if @client.find_all(:xpath, '//*[text()="No data available for selected date range"]').count > 0
|
61
40
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
end
|
71
|
-
if @data.count == 0
|
72
|
-
n_header = header.find_css('td,th').map { |td| td.visible_text }
|
73
|
-
@data << n_header
|
74
|
-
end
|
75
|
-
@data += n_data
|
76
|
-
break
|
41
|
+
rows = @client.find_all :xpath, '//table/*/tr'
|
42
|
+
rows = rows.to_a
|
43
|
+
rows.pop
|
44
|
+
header = rows.shift
|
45
|
+
n_data = rows.map { |tr| tr.find_css('td,th').map { |td| td.visible_text } }
|
46
|
+
if @data.count == 0
|
47
|
+
n_header = header.find_css('td,th').map { |td| td.visible_text }
|
48
|
+
@data << n_header
|
77
49
|
end
|
50
|
+
@data += n_data
|
78
51
|
end
|
79
52
|
|
80
53
|
def wait_for_spin
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: adops_report_scrapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.34
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stayman Hou
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpclient
|