Skip to content

Commit

Permalink
Merge pull request huaying#114 from ege-del/master
Browse files Browse the repository at this point in the history
fixed headless request problem
  • Loading branch information
huaying authored Apr 22, 2021
2 parents 9513906 + e29c477 commit 22d6e1a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions inscrawler/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

from .utils import randmized_sleep

from fake_useragent import UserAgent

class Browser:
def __init__(self, has_screen):
Expand All @@ -21,6 +22,7 @@ def __init__(self, has_screen):
chrome_options.add_argument("--headless")
chrome_options.add_argument("--start-maximized")
chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument("user-agent="+UserAgent().random)
self.driver = webdriver.Chrome(
executable_path="%s/bin/chromedriver" % dir_path,
service_args=service_args,
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ future==0.16.0
selenium==3.9.0
tqdm==4.23.4
pre-commit==1.16.1
black==19.3b0
black==19.3b0
fake-useragent==0.1.11

0 comments on commit 22d6e1a

Please sign in to comment.