Clicking a button with Python to load HTML -
i'm making python script scrapes information youtube playlists.
my issue script not work playlists containing 100+ videos youtube requires click 'load more' button @ bottom of page (see code , image below) in order load more of playlist.
my question how can click button using python in order load rest of page?
<button class="yt-uix-button yt-uix-button-size-default yt-uix-button-default load-more-button yt-uix-load-more browse-items-load-more-button" type="button" onclick=";return false;" aria-label="load more " data-uix-load-more-target-id="pl-load-more-destination" data-uix-load-more-href="/browse_ajax? action_continuation=1&continuation=4qmfsgiueirwtfbmqjzklxhzovhod0iyrhy2zv9rr0t4z2xeovnvddbvsmqabknhvsuzra%253d%253d"><span class="yt-uix-button-content"> <span class="load-more-loading hid"> <span class="yt-spinner"> <span title="loading icon" class="yt-spinner-img yt-sprite"></span> loading... </span> </span> <span class="load-more-text"> load more </span> </span></button>
usually clicking button makes form submitted. form submission http post request. i've checked youtube (using chrome dev-tools) clicking next
button , found being xhr http
request. see picture below:
so after page, might load more (pages 2,3 etc.) thru requesting: https://www.youtube.com/results?search_query=<search term>&page=2&spf=navigate
instead of page=2
set next page number in row, ex. page=3
etc.
the response nice formatted json info need.
Comments
Post a Comment