I am trying to extract the content of a single \"value\" attribute in a specific \"input\" tag on a webpage. I use the following code:
import urllib
f = urll
You can try gazpacho:
Install it using pip install gazpacho
Get the HTML and make the Soup
using:
from gazpacho import get, Soup
soup = Soup(get("http://ip.add.ress.here/")) # get directly returns the html
inputs = soup.find('input', attrs={'name': 'stainfo'}) # Find all the input tags
if inputs:
if type(inputs) is list:
for input in inputs:
print(input.attr.get('value'))
else:
print(inputs.attr.get('value'))
else:
print('No tag found with the attribute name="stainfo")