Advertisement
sanodinnagval

Untitled

Jan 17th, 2022
696
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from requests_html import HTMLSession
  2. from bs4 import BeautifulSoup as bs
  3. import time
  4.  
  5. start_time = time.time()
  6.  
  7. with HTMLSession() as session:
  8.     #p = session.post('https://www.youtube.com/playlist?list=PL3D7BFF1DDBDAAFE5')
  9.     r = session.get('https://www.youtube.com/playlist?list=PL4fGSI1pDJn5kI81J1fYWK5eZRl1zJ5kM')
  10.     r.html.render(scrolldown=60)#(sleep=1) scrolldown=250
  11.     #print(r.html.html)
  12.  
  13. soup = bs(r.html.html, "html.parser")
  14. #out = soup.find_all("meta")
  15. out = soup.find_all('h3',class_="style-scope ytd-playlist-video-renderer")
  16.  
  17. #for i in out:
  18. #    print(i)
  19.  
  20. print(len(out))
  21. print("--- %s seconds ---" % (time.time() - start_time))
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement