Scraping websites contents and retrieve data via prompting experience
Recently I was testing out the real scenarios of how to minic ChatGPT experience to provide myself similar experience to retrieve info based on my own data source. I started to scrape some websites via python libs, e.g. bs4 and create bunch of pdf files which maps to each of the sub pages of the websites. import requests from bs4 import BeautifulSoup from pyhtml2pdf import converter url = 'https://xxxx' baseurl = 'https://yyy' response = requests . get ( url ) soup = BeautifulSoup ( response . text , 'html.parser' ) print ( soup . find_all ( 'a' , href = True )) external_links = [] for link in soup . find_all ( 'a' , href = True ): if link [ 'href' ].startswith( '/' ): print ( baseurl + link [ 'href' ]) print ( link [ 'href' ].replace( "/" , "-" ) + ".pdf" ) filename = link [ 'href' ].replace( "/" , "-" ) ...