diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-03-18 14:57:14 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-03-18 14:57:14 +0100 |
commit | 7352d1932e15b6da85774853e6953c0b390fd75b (patch) | |
tree | fa193c3a2a85e2628645598d8f48a77d0f4604eb /texttv.py | |
parent | Add preliminary parse code. (diff) | |
download | texttv-7352d1932e15b6da85774853e6953c0b390fd75b.tar.gz texttv-7352d1932e15b6da85774853e6953c0b390fd75b.tar.xz |
Working.
Diffstat (limited to 'texttv.py')
-rwxr-xr-x | texttv.py | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/texttv.py b/texttv.py deleted file mode 100755 index a6cf2b1..0000000 --- a/texttv.py +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env python2 - -from httplib2 import Http -from urllib import urlencode -import json -import re -import sys - -def cleanhtml(raw_html): - cleanr = re.compile('<.*?>') - cleantext = re.sub(cleanr, '', raw_html) - return cleantext - -if len(sys.argv) > 1: - page = sys.argv[1] -else: - page = '100' - -http = Http() -url = 'http://api.texttv.nu/api/get/' + page + '?app=python' -headers = {'Accept': 'application/json', 'Accept-Language': 'en-US,en'} -response, content = http.request(url, 'GET', headers=headers) -data = json.loads(content) -print cleanhtml(data[0]['content'][0]) |