#!/usr/bin/env ruby require "bundler/setup" require "douyin_download" require "thor" class DouyinDownloadCli < Thor desc "download URL", "download a video from douyin shared url" def download(url) begin puts "download #{url}" parser = DouyinDownload::Parser.new(url) play_url = parser.play_url description = parser.description filename = parser.download if filename puts "download complete, file: #{filename}" else puts "download failed." end rescue Exception => e puts "download failed: '#{e.message}'" end end end DouyinDownloadCli.start(ARGV)