Ok so I am try to make a script (for my own amusement) that will look through the results of a Kayak.co.uk query and output it using a python script. I am using urllib to grab the content of the webpage query result (example = https://www.kayak.co.uk/flights/DUB-LAX/2018-06-04/2018-06-25/2adults?sort=bestflight_a). However, I need a regular expression to find the prices in £. I have no tried much (because I'am not very good at regular expressions). ALSO does urllib retrieve the JS as well as HTML? I am know that some of the information that I need is included within the JS. Any help would be much appreciated.
This is what I have so far:
def urlRead(url):
"""Gets and returns the content of the chosen URL"""
webpage = urllib.request.urlopen(url)
page_contents = webpage.read()
return page_contents
def getPrices(content):
content = re.findall(r'£435', content.decode())
print(content)
def main():
page_contents = ''
url = input('Please enter in the kayak url!: ')
content = urlRead(url)
getPrices(content)
if __name__ == '__main__':
main()