summaryrefslogtreecommitdiff
path: root/discover-url.py
diff options
context:
space:
mode:
authorYaohan Chen <yaohan.chen@gmail.com>2015-04-16 20:37:15 -0400
committerYaohan Chen <yaohan.chen@gmail.com>2015-04-16 20:37:15 -0400
commit13a1153d52347b769c71cdf0fdec37d91cc602af (patch)
treec9cdce75d8d43415364e36eff2c36920481db20c /discover-url.py
parent3b9be87188dc5dc1f1fcbe8e9a73d9f74546a050 (diff)
downloadhib-dlagent-13a1153d52347b769c71cdf0fdec37d91cc602af.tar.gz
hib-dlagent-13a1153d52347b769c71cdf0fdec37d91cc602af.zip
Use humblebundle-python to work with HIB API
Diffstat (limited to 'discover-url.py')
-rwxr-xr-xdiscover-url.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/discover-url.py b/discover-url.py
new file mode 100755
index 0000000..b60d608
--- /dev/null
+++ b/discover-url.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+
+import humblebundle
+import sys
+import os
+
+filename = sys.argv[2]
+username = sys.argv[3]
+password = os.environ['PASSWORD']
+
+client = humblebundle.HumbleApi()
+client.login(username, password)
+
+order_list = client.order_list()
+for order in order_list:
+ for subproduct in order.subproducts:
+ for download in subproduct.downloads:
+ for download_struct in download.download_struct:
+ url = download_struct.url.web
+ if filename in url:
+ print(url)
+ exit()
+