cask "ximalaya" do
  version "4.0.2,GMCoOSAJWGUzACAAAAKPSoQR,b2c3,74,EB"
  sha256 "0b231b8bf4a883cf2312c2051cddb68f8de6b35cd86f57bc45788879b407f8b9"

  url "https://nativedl.pcdn.xmcdn.com/storages/#{version.csv.third}-audiofreehighqps/#{version.csv.fourth}/#{version.csv.fifth}/#{version.csv.second}.dmg?ct=application/octet-stream&filename=Ximalaya_#{version.csv.first}_x64_c_99",
      verified: "nativedl.pcdn.xmcdn.com/storages/"
  name "ximalaya"
  name "喜马拉雅"
  desc "Platform for podcasting and audio-sharing"
  homepage "https://www.ximalaya.com/"

  livecheck do
    url "https://www.ximalaya.com/down/lite/v2?client=mac&channelId=99"
    regex(%r{storages/(.+)-aud.*?/(.+)/(.+)/(.+)\.dmg.*?Ximalaya[._-](\d+(?:\.\d+)+)}i)
    strategy :header_match do |headers, regex|
      headers["location"].scan(regex).map do |match|
        "#{match[4]},#{match[3]},#{match[0]},#{match[1]},#{match[2]}"
      end
    end
  end

  app "喜马拉雅.app"

  zap trash: [
    "~/Library/Application Support/喜马拉雅",
    "~/Library/Application Support/Ximalaya SetUp",
    "~/Library/Logs/喜马拉雅",
    "~/Library/Preferences/com.gemd.iting.plist",
    "~/Library/Saved Application State/com.gemd.iting.savedState",
  ]
end
