Generation

generate functionTue, 04 Apr 2023

A banner showing a text from another page in real time and can updated anytime it changes

def banner(): url = input('Enter the url of the page: ') text = input('Enter the text that you want to be shown: ') while True: res = requests.get(url) res.raise_for_status() soup = bs4.BeautifulSoup(res.text, 'html.parser') elems = soup.select(text) if elems == []: print('Could not find anything.') else: print(elems[0].text) time.sleep(5) banner()

Questions about programming?Chat with your personal AI assistant