video-data.js 910 B

123456789101112131415161718192021222324252627282930313233
  1. const cheerio = require('cheerio');
  2. const webdriver = require('selenium-webdriver');
  3. var entities = require('html-entities').XmlEntities;
  4. const { saveFile } = require('../tools/save-file');
  5. /**
  6. * 获取视频 (未完)
  7. * @param { WebDriver } driver
  8. */
  9. function videoData(driver) {
  10. return new Promise((resolve, reject) => {
  11. driver.findElement(webdriver.By.js(() => document.querySelectorAll('.J_playVideo')))
  12. .then(videoPlayBtn => {
  13. if(videoPlayBtn){
  14. videoPlayBtn.click();
  15. driver.findElement(webdriver.By.js(() => document.querySelectorAll('.lib-video video')))
  16. .then(videoEle=>{
  17. videoEle.getAttribute('src')
  18. })
  19. }else{
  20. return '';
  21. }
  22. })
  23. });
  24. }
  25. exports.videoData = videoData;