txtv

Swiss text tv in the terminal
git clone https://git.in0rdr.ch/txtv.git
Log | Files | Refs | Pull requests |Archive | README | LICENSE

commit 8568ed12a59e45613fda7ab4f6983509271a5d6d
Author: Isak Lindhé <isak.e.lindhe@gmail.com>
Date:   Thu, 20 Dec 2018 21:03:29 +0100

basic page functionality

Diffstat:
Atxtv.py | 13+++++++++++++
1 file changed, 13 insertions(+), 0 deletions(-)

diff --git a/txtv.py b/txtv.py @@ -0,0 +1,13 @@ +import bs4 +import requests as rq +from sys import argv + + +if __name__ == '__main__': + page = int(argv[1]) + res = rq.get(f'https://www.svt.se/svttext/web/pages/{page}.html') + soup = bs4.BeautifulSoup(res.content, 'html.parser') + root = soup.find('pre', class_='root') + rows = [ s.get_text() for s in root.find_all() if s.get_text() != ' ' ] + for r in rows: + print(r)