Skip to content

Instantly share code, notes, and snippets.

@vipzero
Created May 2, 2019 09:24
Show Gist options
  • Save vipzero/50fa8b616750e8e8253e087e23b67963 to your computer and use it in GitHub Desktop.
Save vipzero/50fa8b616750e8e8253e087e23b67963 to your computer and use it in GitHub Desktop.
post to 5ch from headless browser
import puppeteer from 'puppeteer'
async function main() {
const browser = await puppeteer.launch({
headless: true,
args: ['--no-sandbox', '--disable-setuid-sandbox'],
})
const page = await browser.newPage()
const threadURL = 'http://hebi.5ch.net/test/read.cgi/news4vip/1556625403'
await page.goto(threadURL)
await page.type('form textarea', 'Hello world')
await page.click('form [type=submit]')
await page.waitForSelector('input[value=上記全てを承諾して書き込む]')
await page.click('input[type=submit]')
page.browser.close()
}
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment