Python Forum
Thread Rating:
  • 2 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What terms do I need to know?
#1
I want to be able to find a play (audio) button and activate it (on a BBC website) so the audio plays and when that 15 minute play has finished, for the code to find the next instalment on that page to click it which opens another page and then repeat the process. 

I don’t even know where to start or what terms or phases to search for. My son gave me a python code book but I don’t have the time to become an expert and just want to do what I need to do. So if anyone is kind enough to tell me where to begin and what terms I need to search for, I would be very grateful. Thanks in Advance.
Reply
#2
It would be helpful to know the html at which this button is at, or worst case the URL and hte location of the button you want pressed, as well as the following button after that, and so on.
Recommended Tutorials:
Reply
#3
I have only just registered and I can't include links yet I did try but try this


????:// www.bbc.co.uk/programmes/b08jbc3j#play Put the usual http instead of ????
Thanks.
Reply
#4
I goes under web-automation/scraping you can look at use of Selenium in my tutorial here.
Maybe not the most easy to start with if you new to this.

Button has XPath of:
//*[@id="mediaContainer"]/div[7]/div[1]/button[1]/div[1]/svg/use
So can push button bye find_elements_by_xpath() with Selenium.
Reply
#5
Here is a code which gets the links to every page and once the web page is opened the audio starts. I don't know how to proceed with the links in order to open them in the browser, except with subprocess and xdg-open ( Linux only)

from bs4 import BeautifulSoup
import requests

bage = requests.get("http://www.bbc.co.uk/programmes/b006qy2s/episodes/player").content
soup = BeautifulSoup(page, 'lxml')

links = []
for link in soup.find_all('a', {'property': 'url'}):
    try:
        if 'play' in link['resource']:
            links.append(link)
            print(link)
    except:
        pass

links.reverse() # to start from audio 1
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#6
(Mar-31-2017, 12:37 PM)psocretes Wrote: I can't include links yet
you are only restricted on your first post as an anti spam measure
Recommended Tutorials:
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020