Skip to content

Commit 2fb4bec

Browse files
authored
Fix intigriti (#190)
Co-authored-by: arkadiyt <>
1 parent ba26376 commit 2fb4bec

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

lib/bounty-targets/intigriti.rb

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,24 @@ def uris
4444

4545
private
4646

47+
def find_programs(obj)
48+
case obj
49+
when Array
50+
obj.each do |elm|
51+
result = find_programs(elm)
52+
return result unless result.nil?
53+
end
54+
when Hash
55+
return obj if obj.key?('programs')
56+
57+
obj.each do |_, value|
58+
result = find_programs(value)
59+
return result unless result.nil?
60+
end
61+
end
62+
nil
63+
end
64+
4765
def encode(component)
4866
# Ruby dropped URI.encode, and CGI.escape converts spaces to `+` instead of `%20`
4967
URI.encode_www_form_component(component).gsub('+', '%20')
@@ -54,7 +72,7 @@ def directory_index
5472
script = page.css('script').max_by do |node|
5573
node.to_s.length
5674
end.inner_text.match(/self\.__next_f\.push\(\[1,(.*)\]/)[1]
57-
programs = JSON.parse(JSON.parse(script)[2..])[3]['children'][1][3]['programs']
75+
programs = find_programs(JSON.parse(JSON.parse(script)[2..]))['programs']
5876
programs.map do |program|
5977
{
6078
id: program['programId'],

0 commit comments

Comments
 (0)