mirror of
https://github.com/timberjoegithub/GoogleScrape.git
synced 2026-07-22 00:19:48 +00:00
update
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
#data
|
|
||||||
import time
|
import time
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
@@ -9,8 +8,6 @@ from openpyxl import load_workbook
|
|||||||
import pandas as pd
|
import pandas as pd
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from dateutil.relativedelta import relativedelta
|
from dateutil.relativedelta import relativedelta
|
||||||
|
|
||||||
#instagram
|
|
||||||
import ast
|
import ast
|
||||||
import base64
|
import base64
|
||||||
import requests
|
import requests
|
||||||
@@ -539,12 +536,12 @@ def get_google_data(driver,outputs ):
|
|||||||
##################################################################################################
|
##################################################################################################
|
||||||
|
|
||||||
# Do the google_scroll
|
# Do the google_scroll
|
||||||
def google_scroll(counter_google,driver):
|
def google_scroll(counter_google_scroll,driver):
|
||||||
"""
|
"""
|
||||||
Scrolls down a Google search results page a specified number of times.
|
Scrolls down a Google search results page a specified number of times.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
counter_google (int): The number of times to scroll down the page.
|
counter_google_scroll (int): The number of times to scroll down the page.
|
||||||
driver: The Selenium WebDriver instance.
|
driver: The Selenium WebDriver instance.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
@@ -558,7 +555,7 @@ def google_scroll(counter_google,driver):
|
|||||||
scrollable_div = driver.find_element(By.XPATH,
|
scrollable_div = driver.find_element(By.XPATH,
|
||||||
'//*[@id="QA0Szd"]/div/div/div[1]/div[2]/div/div[1]/div/div/div[5]/div[2]')
|
'//*[@id="QA0Szd"]/div/div/div[1]/div[2]/div/div[1]/div/div/div[5]/div[2]')
|
||||||
# '//*[@id="QA0Szd"]/div/div/div[1]/div[2]/div/div[1]/div/div/div[2]/div[10]/div')
|
# '//*[@id="QA0Szd"]/div/div/div[1]/div[2]/div/div[1]/div/div/div[2]/div[10]/div')
|
||||||
for _i in range(counter_google):
|
for _i in range(counter_google_scroll):
|
||||||
try:
|
try:
|
||||||
google_scroll = driver.execute_script(
|
google_scroll = driver.execute_script(
|
||||||
'document.getElementsByClassName("dS8AEf")[0].\
|
'document.getElementsByClassName("dS8AEf")[0].\
|
||||||
|
|||||||
Reference in New Issue
Block a user