generate functionFri, 17 Feb 2023

find all public files indexed by google inside url https://ceditor.setka.io/stk-plugins

require 'open-uri' require 'nokogiri' require 'google_drive' def find_all_public_files_indexed_by_google(url, path_to_google_drive_credentials) session = GoogleDrive::Session.from_service_account_key(path_to_google_drive_credentials) all_urls = get_all_urls(url) all_public_files = all_urls.select { |url| get_result_from_google(url) } all_public_files.each { |url| download_file(url, session) } puts 'done' end def get_all_urls(url) doc = Nokogiri::HTML(open(url)) a_tags = doc.css('a') a_tags.map { |a| a.attribute('href').value } end def get_result_from_google(url) google_url = "https://www.google.co.kr/

Questions about programming?Chat with your personal AI assistant