Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from selenium import webdriver
- from selenium.webdriver.chrome.options import Options
- from selenium.webdriver.common.keys import Keys
- from bs4 import BeautifulSoup
- import urllib.request
- import requests
- import time
- import shutil
- import os
- options = Options()
- # options.add_argument('--headless')
- # options.add_argument('--log-level=3')
- driver = webdriver.Chrome(options=options)
- driver.implicitly_wait(30)
- title = "https://ec.sod.co.jp/prime/videos/?id=STARS-206"
- driver.get(title)
- ask_button = driver.find_element_by_css_selector('.enter a')
- ask_button.click()
- time.sleep(5)
- s = requests.session()
- for cookie in driver.get_cookies():
- c = {cookie['name']: cookie['value']}
- s.cookies.update(c)
- imgurl = 'https://dy43ylo5q3vt8.cloudfront.net/_pics/202002/stars_206/stars_206_l.jpg'
- response = requests.get(imgurl, stream=True)
- with open("test.jpg", 'wb') as out_file:
- shutil.copyfileobj(response.raw, out_file)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement