Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from requests_html import HTMLSession
- from bs4 import BeautifulSoup as bs
- import time
- start_time = time.time()
- with HTMLSession() as session:
- #p = session.post('https://www.youtube.com/playlist?list=PL3D7BFF1DDBDAAFE5')
- r = session.get('https://www.youtube.com/playlist?list=PL4fGSI1pDJn5kI81J1fYWK5eZRl1zJ5kM')
- r.html.render(scrolldown=60)#(sleep=1) scrolldown=250
- #print(r.html.html)
- soup = bs(r.html.html, "html.parser")
- #out = soup.find_all("meta")
- out = soup.find_all('h3',class_="style-scope ytd-playlist-video-renderer")
- #for i in out:
- # print(i)
- print(len(out))
- print("--- %s seconds ---" % (time.time() - start_time))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement