4

I'm trying to download a video from a website, they use a company called ooyala to host their videos, so i think you can't find it through searching the elements on the page. I'm trying to use selenium to click the play button, and get the url of the video through the network tab. This is my code so far

import time
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities


def get_link():
    chrome_options = Options()
    chrome_options.add_experimental_option("detach", True)
    caps = DesiredCapabilities.CHROME
    caps['loggingPrefs'] = {'browser': 'ALL'}
    url_main = r'https://www.channelnewsasia.com/news/video-on-demand/japanhour'
    path = r'C:\Users\User\Downloads\Internet download\chromedriver_win32\chromedriver.exe'
    driver = webdriver.Chrome(path, chrome_options=chrome_options,desired_capabilities=caps)
    driver.get(url_main)
    time.sleep(10)
    link = driver.find_element_by_class_name('video__custom-duration')
    link.click()
    while True:
        for entry in driver.get_log('browser'):
            print(entry)

The clicking works but the loggingPrefs doesn't, I think it's returning error messages. I've tried to look for the documentation but i can't find what other types of args goes into the DesiredCapabilities dictionary. Can anyone give me some assistance?

TLDR:

How do I read from the network tab in chrome?

Additional info.

The url i'm using is georestricted to singapore, so here's another random video for anyone helping me, not using ooyala though. https://www.rollingstone.com/music/music-news/norwegian-dj-cashmere-cat-goes-spartan-on-with-me-premiere-71196/

If you accessing the original url with a vpn, heres the link i am trying to find automatically https://mediacorp-videosaz.akamaized.net/c642f1d9-bfcd-46fe-8304-b4bf5c236d1e/BsY3hkajE6J_wuuYqP4M6HATpdD8CwlF.ism/QualityLevels(1984000)/Manifest(format=m3u8-aapl)

2
  • I believe that with the help of pyautoit you will be able to perform the actions on the browser to open network tab in developer tools. pypi.org/project/PyAutoIt Commented May 15, 2020 at 17:12
  • I overcame the problem with a bad solution by using mouse automation to search the network tab, click the position where the url I'm looking for would show up and then copy it. Then I used tkinter clipboard.get to get the url from clipboard. I'm still looking for a better solution. Commented Nov 11, 2020 at 18:34

1 Answer 1

1

I used Selenium to get the information I used to search in the network tab manually.

Check out the link below for further details

https://stackoverflow.com/a/68363046/8491363

Selenium 4.0 will officially support accessing Chrome Devtool information but it's still in beta. On 3.0, you can try logging performance as I suggested.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.