プロジェクト

全般

プロフィール

バグ #1593 » 0001-nicovideo-insutabae.patch

Izumi Tsutsui, 2023-10-09 04:19

差分を表示:

plugin/photo_support/photo_support.rb
334 334

  
335 335
  # ニコニコ動画
336 336
  defimageopener('NicoVideo', Plugin::PhotoSupport::NICOVIDEO_PATTERN) do |display_url|
337
    url = Plugin::PhotoSupport::NICOVIDEO_PATTERN.match(display_url) do |m|
338
      connection = HTTPClient.new
339
      connection.ssl_config.set_default_paths
340
      json = connection.get_content("https://api.ce.nicovideo.jp/nicoapi/v1/video.info", query: { __format: 'json', v: m[1] })
341
      res = JSON.parse(json)
342
      if res.dig('nicovideo_video_response', '@status') == 'ok'
343
        res.dig('nicovideo_video_response', 'video', 'thumbnail_url')
344
      end
345
    end
346
    URI.open(url) if url
337
    img = Plugin::PhotoSupport.インスタ映え(display_url)
338
    URI.open(img) if img
347 339
  end
348 340
end
    (1-1/1)