Esempio n. 1
0
                                         curr_time.strftime("%Y%m%d%H%M"))
        print("Screenshot taken")

        ### Close the browser
        scraperfunctions.close_browser(browser)

        ### Close our virtual display
        display.stop()
        print("Display closed")

        ### Perform closing actions
        print("Successfully downloaded the page!")
        #scraperfunctions.store_mysql_log(mysql_log_name, metadata, pubshort, curr_time, "1", "1", "") # Log success
    except:
        scraperfunctions.store_mysql_log(mysql_log_name, metadata, pubshort,
                                         curr_time, "1", "0",
                                         "")  # Log failure

if download_mobile == 1:
    # Grab Mobile Page
    try:
        ### Initiate our virtual display
        print("Initiating virtual display")
        display = Display(visible=0, size=(1920, 1080))
        display.start()

        ### Let's start our browser
        browser = scraperfunctions.create_browser(mobile=1)

        ### Let's load the page work
        scraperfunctions.load_homepage(browser, pubshort, puburl_mobile)
Esempio n. 2
0
        ### Save a screenshot
        scraperfunctions.take_screenshot(browser, screenshots_dir, pubshort, curr_time.strftime("%Y%m%d%H%M"))
        print("Screenshot taken")
        
        ### Close the browser
        scraperfunctions.close_browser(browser)
        
        ### Close our virtual display
        display.stop()
        print("Display closed")
        
        ### Perform closing actions
        print("Successfully downloaded the page!")
        #scraperfunctions.store_mysql_log(mysql_log_name, metadata, pubshort, curr_time, "1", "1", "") # Log success
    except:
        scraperfunctions.store_mysql_log(mysql_log_name, metadata, pubshort, curr_time, "1", "0", "") # Log failure
        
if download_mobile == 1:
    # Grab Mobile Page
    try:
        ### Initiate our virtual display
        print("Initiating virtual display")
        display = Display(visible=0, size=(1920, 1080))
        display.start()
    
        ### Let's start our browser
        browser = scraperfunctions.create_browser(mobile=1)
        
        ### Let's load the page work
        scraperfunctions.load_homepage(browser, pubshort, puburl_mobile)