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'