Refactor signature extractor

このコミットが含まれているのは:
Omar Roth 2018-09-14 19:50:11 -05:00
コミット 5cd137d808
2個のファイルの変更3行の追加3行の削除

ファイルの表示

@ -141,8 +141,7 @@ end
def update_decrypt_function def update_decrypt_function
loop do loop do
begin begin
client = make_client(YT_URL) decrypt_function = fetch_decrypt_function
decrypt_function = fetch_decrypt_function(client)
rescue ex rescue ex
next next
end end

ファイルの表示

@ -1,4 +1,5 @@
def fetch_decrypt_function(client, id = "CvFH_6DNRCY") def fetch_decrypt_function(id = "CvFH_6DNRCY")
client = make_client(YT_URL)
document = client.get("/watch?v=#{id}").body document = client.get("/watch?v=#{id}").body
url = document.match(/src="(?<url>\/yts\/jsbin\/player-.{9}\/en_US\/base.js)"/).not_nil!["url"] url = document.match(/src="(?<url>\/yts\/jsbin\/player-.{9}\/en_US\/base.js)"/).not_nil!["url"]
player = client.get(url).body player = client.get(url).body