<commit_before># encoding: utf-8
require 'net/http'

module MylineCommand
  class UnbrellaAdviser
    def initialize()
      #近畿地方 大阪府のデータ
      @targeturl = 'https://tenki.jp/indexes/umbrella/6/30/6200/'
    end

    def get_umbrella_data
      uri = URI.parse(@targeturl)
      res = Net::HTTP.get(uri)
      res.force_encoding("utf-8")
      res =~ /<section class="today-weather"><!-- 今日の天気 -->(.+?)<\/section>/m
      today_html = $1
      today_html =~ />指数:(.+?)</
      @today_rainypercent = $1
      today_html =~ /indexes-telop-1">(.+?)<\/p>/
      @today_umbrella_advice = $1

      res =~ /<section class="today-weather"><!-- 今日の天気 -->(.+?)<\/section>/m
      tomorrow_html = $1
      tomorrow_html =~ />指数:(.+?)</
      @tomorrow_rainypercent = $1
      tomorrow_html =~ /indexes-telop-1">(.+?)<\/p>/
      @tomorrow_umbrella_advice = $1

      umbrella_data = {today_rainypercent: @today_rainypercent,
                       today_umbrella_advice: @today_umbrella_advice,
                       tomorrow_rainypercent: @tomorrow_rainypercent,
                       tomorrow_umbrella_advice: @tomorrow_umbrella_advice}
      return umbrella_data
    end
  end
end<commit_msg>明日の傘指数スクレイピング箇所修正<commit_after># encoding: utf-8
require 'net/http'

module MylineCommand
  class UnbrellaAdviser
    def initialize()
      #近畿地方 大阪府のデータ
      @targeturl = 'https://tenki.jp/indexes/umbrella/6/30/6200/'
    end

    def get_umbrella_data
      uri = URI.parse(@targeturl)
      res = Net::HTTP.get(uri)
      res.force_encoding("utf-8")
      res =~ /<section class="today-weather"><!-- 今日の天気 -->(.+?)<\/section>/m
      today_html = $1
      today_html =~ />指数:(.+?)</
      @today_rainypercent = $1
      today_html =~ /indexes-telop-1">(.+?)<\/p>/
      @today_umbrella_advice = $1

      res =~ /<section class="today-weather"><!-- 明日の天気 -->(.+?)<\/section>/m
      tomorrow_html = $1
      tomorrow_html =~ />指数:(.+?)</
      @tomorrow_rainypercent = $1
      tomorrow_html =~ /indexes-telop-1">(.+?)<\/p>/
      @tomorrow_umbrella_advice = $1

      umbrella_data = {today_rainypercent: @today_rainypercent,
                       today_umbrella_advice: @today_umbrella_advice,
                       tomorrow_rainypercent: @tomorrow_rainypercent,
                       tomorrow_umbrella_advice: @tomorrow_umbrella_advice}
      return umbrella_data
    end
  end
end
{'fraction_non_alphanumeric': 0.15378151260504203, 'fraction_numerical': 0.014285714285714285, 'mean_word_length': 2.455732946298984, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 27, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '657120', 'n_tokens_mistral': 961, 'n_tokens_neox': 896, 'n_words': 133}