47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
# File 'lib/clauneck.rb', line 47
def run(api_key: nil, proxy: nil, pages: nil, output: nil, google_url: nil, params: {}, urls: nil)
options = {
api_key: api_key,
proxy: proxy,
pages: pages,
output: output,
google_url: google_url,
params: params,
urls: urls
}
if options.values.all? { |v| v.nil? || v.empty? }
options = parse_options
else
options[:proxies] = get_proxies proxy
end
if options[:urls].nil? || options[:urls].empty?
pages = fetch_pages_via_serpapi(options[:api_key], options[:google_url], options[:params], options[:pages])
links = parse_pages(pages)
else
links = get_urls(urls)
end
fetch_and_write_information(links, options[:proxies], options[:output])
end
|