Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const puppeteer = require('puppeteer');
- const [,, params] = process.argv;
- if (params === undefined) {
- console.error('videos required!');
- return;
- }
- const videos = JSON.parse(params);
- (async () => {
- const browser = await puppeteer.launch({args: ['--no-sandbox', '--disable-setuid-sandbox']});
- await Promise.all(videos.map(async (video) => {
- //
- // }));
- //for (const video of videos) {
- console.log("im here");
- const page = await browser.newPage();
- await page._client.send('Page.setDownloadBehavior', {behavior: 'allow', downloadPath: video['path']});
- try {
- await page.goto(video['url']);
- await page.waitForTimeout(3000);
- // await page.click('[data-title^="[SRT]"][data-title*="(auto-generated)"]');
- await page.click('[data-title^="[TXT]"][data-title*="(auto-generated)"]');
- } catch (error) {
- console.error(error);
- }
- await page.waitForTimeout(3000);
- await page.close();
- // }
- }));
- await browser.close();
- })();
Advertisement
Add Comment
Please, Sign In to add comment