-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
no twitter implementation yet, however this converts image and downloads it
- Loading branch information
1 parent
e74aed7
commit 63244c7
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |