Skip to content

Instantly share code, notes, and snippets.

@sbuss
Created November 18, 2015 06:54
Show Gist options
  • Save sbuss/6e0cab1974f4755725e6 to your computer and use it in GitHub Desktop.
Save sbuss/6e0cab1974f4755725e6 to your computer and use it in GitHub Desktop.
import sys
# import from 21 Bitcoin Library
from two1.commands.config import Config
from two1.lib.wallet import Wallet
from two1.lib.bitrequests import BitTransferRequests
wallet = Wallet()
username = Config().username
requests = BitTransferRequests(wallet, username)
DOWNTUBER_ADDR="10.147.135.231"
# hit the bitcoin-enabled endpoint you're hosting on the 21 Bitcoin Computer
def get(url):
return requests.post(
url='http://{url}:5000/'.format(
url=DOWNTUBER_ADDR),
data={'url': url})
# make the function available at the command line
if __name__ == '__main__':
if len(sys.argv) > 1:
urls = sys.argv[1:]
else:
urls = ['https://www.youtube.com/watch?v=Zcq_xLi2NGo']
for url in urls:
print("Downloading %s" % url)
print(get(url).text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment