Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from time import time
- from selenium.webdriver.chrome.options import Options
- from seleniumwire import webdriver
- from selenium.webdriver.common.by import By
- from selenium.webdriver.support.ui import WebDriverWait
- from selenium.webdriver.support import expected_conditions as EC
- from seleniumwire.request import Request, Response
- def main():
- chrome_options = Options()
- chrome_options.headless = True
- driver = webdriver.Chrome(
- options=chrome_options,
- seleniumwire_options={
- 'disable_encoding': True
- })
- driver.response_interceptor = response_interceptor
- driver.get('https://telemetr.me/channels/cat/%D0%91%D0%B8%D0%B7%D0%BD%D0%B5%D1%81%20%D0%B8%20%D1%84%D0%B8%D0%BD%D0%B0%D0%BD%D1%81%D1%8B/?page=1')
- elem = driver.find_element_by_css_selector(
- '[data-do="show_dynamic_participants"]')
- elem.click()
- # request = driver.wait_for_request('/index.php')
- input()
- # print(driver.last_request.body.decode('utf-8'))
- def response_interceptor(request: Request, response: Response):
- if ('index.php' in request.url):
- print(response.body)
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement