line-markers/app/controllers/scraping_pages/htmls_controller.rb
# $ rails g controller ScrapingPages::Htmls create
$ rails g controller ScrapingPages::Htmls create
$ rails g controller ScrapingPages :: Htmls create
def create
    set_scraping_page 
    urls = Array.new
    urls[0] = @scraping_page.page_url 
    requests = scraping_pages_html(urls) 
    charset = @scraping_page.charset
    requests.map { |request|
      directory_path = @scraping_page.directory_path
      file_name = get_file_name(@scraping_page.id)
      body = request.response.body
      save_html(directory_path, file_name, body, charset) 
      @scraping_page.scraping_latest_date = DateTime.now
      @scraping_page.save
    }
  end
def create set_scraping_page urls = Array . new urls [ 0 ] = @scraping_page . page_url requests = scraping_pages_html ( urls ) charset = @scraping_page . charset requests . map { | request | directory_path = @scraping_page . directory_path file_name = get_file_name ( @scraping_page . id ) body = request . response . body save_html ( directory_path , file_name , body , charset ) @scraping_page . scraping_latest_date = DateTime . now @scraping_page . save } end
$ rails g controller ScrapingPages::Htmls create
$ rails g controller ScrapingPages :: Htmls create
#--- Set page url ---# # private method # Runs multiple HTTP requests in parallel. If only one request, use url[0]. #--- Set HTTP request ---# # concerns/scrapable.rb # Scraping loop action # concerns/file_savable.rb # Save scraping latest date