From 63244c76f656abb916c7cf298638bbbedb873387 Mon Sep 17 00:00:00 2001 From: elisha johnsunder Date: Tue, 17 Jan 2017 19:37:53 -0500 Subject: [PATCH] init no twitter implementation yet, however this converts image and downloads it --- matrix.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 matrix.py diff --git a/matrix.py b/matrix.py new file mode 100644 index 0000000..a0960f0 --- /dev/null +++ b/matrix.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python +from bs4 import BeautifulSoup +import requests +import re +import json +import re +import urllib.request + + + + +def uploadImage(url): + file = {'image': open('test.png','rb')} + r = requests.post(url, files=file) + soup = BeautifulSoup(r.text,"html.parser") + + imageLink = (soup.find(bgcolor='black')).find('img')['src'] + nameRegex = re.compile('[^/]*$') + imageName = "./" + imageName += re.search(nameRegex, imageLink).group(0) + urllib.request.urlretrieve(imageLink, imageName) + +def main(): + url = "http://www.text-image.com/convert/matrix.cgi" + uploadImage(url) +main()