<jupyter_start><jupyter_text>Set Options<jupyter_code>options = Options()
options.headless = True
webpage = webdriver.Firefox(firefox_options=options, executable_path = './drivers/geckodriver')<jupyter_output><ipython-input-2-9ff0a28c3367>:3: DeprecationWarning: use options instead of firefox_options
  webpage = webdriver.Firefox(firefox_options=options, executable_path = './drivers/geckodriver')<jupyter_text>Set Url<jupyter_code># index url
urlpage = 'https://docs.oracle.com/en/solutions/index.html?type=reference-architectures&page=0&is=true&sort=0' 
# get web page
webpage.get(urlpage)<jupyter_output><empty_output><jupyter_text>Search for webpages links<jupyter_code># execute script to scroll down the page
for i in range(10):
    webpage.execute_script("window.scrollTo(0, document.body.scrollHeight);var lenOfPage=document.body.scrollHeight;return lenOfPage;")
    # sleep for 10s
    time.sleep(3)
all_solution_links = webpage.find_elements_by_class_name("solutionurl")
print(f"Total links founded: {len(all_solution_links)}")<jupyter_output>Total links founded: 78<jupyter_text>Get image links form every web page<jupyter_code>url_architecture = []
for href in all_solution_links:
    url_architecture.append(href.get_attribute('href'))<jupyter_output><empty_output><jupyter_text>Get images<jupyter_code>for url in url_architecture:
    
    # get current link
    webpage.get(url)
    
    # execute script to scroll down the page
    for i in range(10):
        webpage.execute_script("window.scrollTo(0, document.body.scrollHeight);var lenOfPage=document.body.scrollHeight;return lenOfPage;")
        # wait
        time.sleep(3)
        
    # get image source
    for src in webpage.find_elements_by_tag_name("img"):
        
        image_url = src.get_attribute('src')

        # save image
        image_folder = 'content'
        image_name = image_url.split('/')[-1]
        img_data = requests.get(image_url).content

        with open(f'{image_folder}/{image_name}', 'wb') as handler:
            handler.write(img_data)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11175337186897881, 'fraction_numerical': 0.012042389210019268, 'mean_word_length': 5.0202898550724635, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 20, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '542281', 'license': 'MIT', 'n_tokens_mistral': 717, 'n_tokens_neox': 690, 'n_words': 118, 'path': 'providers/oracle/2-selenium/9-oracle-images.ipynb', 'repo_name': 'pavelsjo/cloud-scraper', 'size': '2076'}