Skip to content

Instantly share code, notes, and snippets.

@venj
Last active December 13, 2015 19:58
Show Gist options
  • Save venj/4965974 to your computer and use it in GitHub Desktop.
Save venj/4965974 to your computer and use it in GitHub Desktop.
a test script for using xunlei-lixian python objects inside ruby.
#!/usr/bin/env ruby
require "rubygems"
require "rubypython"
require "digest"
RP = RubyPython
RP.start
username = ARGV[0]
password = ARGV[1]
cookie = File.join ENV["HOME"], ".xunlei.lixian.cookies"
exit if ARGV.size != 2
sys = RP.import 'sys'
sys.path.append '/usr/local/bin/xunlei-lixian/'
lixian = RP.import 'lixian'
encrypted_password = Digest::MD5.hexdigest(Digest::MD5.hexdigest password)
client = lixian.XunleiClient username, encrypted_password, cookie
tasks = client.read_all_tasks
puts tasks
RP.stop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment