Created
October 6, 2023 17:54
-
-
Save techwiz37/744579a69768e02193a41610ad0a687c to your computer and use it in GitHub Desktop.
Scrape vn anime
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| 2023 © Amirul Dev | |
| recode sertakan sumber biar semangat update :) | |
| custom request? silahkan donasi | |
| wa: 085157489446 | |
| */ | |
| import playwr from 'playwright' | |
| const browser = await playwr.chromium.launch({ | |
| headless: false, | |
| acceptDownloads: true, // permission download | |
| downloadsPath: '@amiruldev' // path download | |
| }) | |
| const context = await browser.newContext(); | |
| const page = await context.newPage(); | |
| // ubah ukuran | |
| await page.setViewportSize({ width: 501, height: 700 }); | |
| await page.goto('https://plachta-vits-umamusume-voice-synthesizer.hf.space/') | |
| await page.waitForSelector('#tts-input > label > textarea') | |
| // element selector text area | |
| const tArea = '#tts-input > label > textarea' | |
| await page.$eval(tArea, (area) => { | |
| area.value = '' // kosongin value text area | |
| }) | |
| // input text area | |
| await page.type(tArea, 'こんにちわ。') | |
| // klik button | |
| await page.click('#component-24') | |
| // menunggu selector | |
| await page.waitForSelector('audio[src]') | |
| const audio = await page.$('#tts-audio audio'); | |
| if (audio) { | |
| // ambil link didalam src | |
| const audioSrc = await audio.getAttribute('src'); | |
| console.log(`Link audio: https://plachta-vits-umamusume-voice-synthesizer.hf.space/${audioSrc}`) | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Kode barunya, Udah ada fitur tambahan: