import urllib.request
search = input("Insert your search terms: ")
tag = input("Insert your tag: ")
urlstring = "http://appft.uspto.gov/netacgi/nph-Parser?Sect1=PTO2&Sect2=HITOFF&u=%2Fnetahtml%2FPTO%2Fsearch-adv.html&r=0&p={{page}}&f=S&l=50&Query={{tag}}%2F%22{{query}}%22&d=PG01"
# Replace placeholder strings with actual input
urlstring = urlstring.replace('{{page}}', str(1))
urlstring = urlstring.replace('{{tag}}', tag)
urlstring = urlstring.replace('{{query}}', search.strip().replace(' ', '+'))
print(urlstring)
# Get raw html from the query url
response = urllib.request.urlopen(urlstring)
html = response.read()
print(html)
No comments:
Post a Comment