0

So I am watching some videos on a webpage where there is a playlist. The problem with the playlist is that it doesnt "auto-play". SO everytime one video ends I have to manually go to the playlist and click on the "next" link.

Is there any way to automate this? SOmething like:

1.go to this page 2.select the active item in the list(which contains the video duration) 3.extract the video duration from the active item and let the video play 4.After video duration, ex: 4min, click on the next element of the list and let it play for the video duration... ... 

I am confortable with python and jquery. using the google chrome console is possible to achive this? Or any external script that I can run? I have also seen Imacros but it records specific itens, and I need something dynamic/procedual. Like find the next element of the active selected item.

Thank you in advance guys.

1 Answer 1

1

You can use Selenium to automate a variety of browsers.

There are Python bindings for Selenium in PyPI - you can see some examples of the code on the linked page, for example:

  • open a new Firefox browser
  • load the Yahoo homepage
  • search for "seleniumhq"
  • close the browser

from selenium import webdriver from selenium.webdriver.common.keys import Keys browser = webdriver.Firefox() browser.get('http://www.yahoo.com') assert 'Yahoo!' in browser.title elem = browser.find_element_by_name('p') # Find the search box elem.send_keys('seleniumhq' + Keys.RETURN) browser.quit() 
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for the input DNA. Just a quick question: Is it possible to tell the code to hold for 4min(video duration) and then click on the next link? Thanks
You can just use time.sleep(). See also selenium-python.readthedocs.org/en/latest/waits.html for ways to wait for certain conditions to occur.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.