Created
January 16, 2023 12:46
-
-
Save pointofpresence/983dfeb9e1778498886ba11257bb4936 to your computer and use it in GitHub Desktop.
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
def get_page(url): | |
ua = r'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.50 Safari/537.36' | |
exe = r'C:\Program Files\Google\Chrome\Application\chrome.exe' | |
args = f'"{exe}" --headless --disable-gpu --dump-dom --user-agent="{ua}" "{url}"' | |
sp = subprocess.Popen(args, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | |
out, err = sp.communicate() | |
print(err, 'error') if err else None | |
return out.decode('utf-8') if out else '' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment