init commit

This commit is contained in:
Nick Leffler 2020-03-07 12:49:38 -05:00
parent fae1af7da6
commit 849c628df7
2 changed files with 17 additions and 0 deletions

13
getPage.py Normal file
View File

@ -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:
#<p id="intro-text">Yay! Supports javascript</p>

4
run.sh Executable file
View File

@ -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'