From 849c628df7b74104ccfacc84f2dbeb5bdfd82722 Mon Sep 17 00:00:00 2001 From: Nick Leffler Date: Sat, 7 Mar 2020 12:49:38 -0500 Subject: [PATCH] init commit --- getPage.py | 13 +++++++++++++ run.sh | 4 ++++ 2 files changed, 17 insertions(+) create mode 100644 getPage.py create mode 100755 run.sh diff --git a/getPage.py b/getPage.py new file mode 100644 index 0000000..07e4cc3 --- /dev/null +++ b/getPage.py @@ -0,0 +1,13 @@ +import dryscrape +from bs4 import BeautifulSoup + +dryscrape.start_xvfb() + +session = dryscrape.Session() +session.visit('http://192.168.1.1') +response = session.body() +soup = BeautifulSoup(response,features="lxml") +print(soup) +#soup.find(id="intro-text") +# Result: +#

Yay! Supports javascript

diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..3e72767 --- /dev/null +++ b/run.sh @@ -0,0 +1,4 @@ +#!/bin/bash +mydir1="${0%/*}" + +python "${mydir1}/getPage.py" | grep 'id="statusBar_battery" style="">' | grep -o -P '.{0,3}%.{0,0}' | sed 's/>//g' | sed 's/%//g'