-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3a6ba73
commit cef0ab9
Showing
7 changed files
with
187 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.idea/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,10 @@ | ||
# spiders | ||
# spiders | ||
|
||
## Installation | ||
|
||
``` shell | ||
# Pre-install | ||
pip install rsa qrcode pillow requests pycryptodome requests_toolbelt gmssl PyExecJS | ||
# Our protagonist | ||
pip install DecryptLogin | ||
``` |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# selenium 4 | ||
from selenium import webdriver | ||
|
||
from selenium.webdriver.chrome.service import Service as ChromeService | ||
from webdriver_manager.chrome import ChromeDriverManager | ||
|
||
from selenium.webdriver.edge.service import Service as EdgeService | ||
from webdriver_manager.microsoft import EdgeChromiumDriverManager | ||
|
||
from selenium.webdriver.firefox.service import Service as FirefoxService | ||
from webdriver_manager.firefox import GeckoDriverManager | ||
|
||
|
||
driverChrome = webdriver.Chrome(service=ChromeService(ChromeDriverManager().install())) | ||
|
||
driverEdge = webdriver.Edge(service=EdgeService(EdgeChromiumDriverManager().install())) | ||
|
||
driverFirefox = webdriver.Firefox(service=FirefoxService(GeckoDriverManager().install())) |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
|
||
from selenium import webdriver | ||
from selenium.webdriver.common.by import By | ||
from selenium.common.exceptions import NoSuchElementException | ||
from scrapy.selector import Selector | ||
|
||
from webparse.steam_review_parse import steam_helper | ||
|
||
driver = webdriver.Chrome() | ||
|
||
# Crawl Target | ||
driver.get('https://steamcommunity.com/app/990080/reviews/?browsefilter=toprated&snr=1_5_100010_') | ||
|
||
# User Configuration | ||
target_page = 10 # 100 pages contain about 1000 reviews | ||
waiting_time = 1 # range of waiting in each time | ||
tolerated_times = 30 # number of tolerant times for each page | ||
|
||
# Start Crawling | ||
page_counter = 1 | ||
current_tolerated = tolerated_times | ||
while True: | ||
|
||
try: | ||
driver.implicitly_wait(waiting_time) | ||
driver.find_element(By.ID, 'page' + str(page_counter)) | ||
except NoSuchElementException: | ||
# Not find | ||
# - rolling -> to avoid too much rolling - since one window maybe contain several page block | ||
driver.execute_script("window.scrollTo(0, document.body.scrollHeight)") | ||
# - decrease tolerant | ||
if current_tolerated > 0: | ||
current_tolerated -= 1 | ||
continue | ||
else: | ||
# Reach the end or Network break | ||
break | ||
else: | ||
# Find new page, reset tolerated counter | ||
if current_tolerated != tolerated_times: | ||
current_tolerated = tolerated_times | ||
# Page counter + 1 | ||
page_counter += 1 | ||
if page_counter == target_page: | ||
break | ||
|
||
# Start Parsing | ||
selector = Selector(text=driver.page_source) | ||
|
||
steam_helper(selector, 'Hogwarts-Legacy.csv') | ||
|
||
driver.quit() | ||
|