4CHAN-COMPLETO ?
www.4chan.org API no oficial de solo lectura.
npm install 4chan-full
Controlador de solicitudes personalizado ( new FourChanFull(yourHandler)
);
Obtener hilo ( .thread(boardCode, threadId)
)
Observando el hilo en busca de actualizaciones ( .threadWatcher(boardCode, threadId, [options])
);
Obtener tablero ( .board(boardCode, page)
)
Obtener archivo ( .archive(boardCode)
)
Obtener temas populares ( .popular(safetyType)
)
Obtener estadísticas ( .stats()
)
Lista de tableros ( .boards
)
Ese pequeño script enumera todos los archivos del hilo.
const { fchf } = require ( "4chan-full" ) ;
( async ( ) => {
const thread = await fchf . thread ( "wg" , "7694540" ) ;
// thread.file -> Thread owner (OP) file.
// thread.replies[?].file -> reply file.
const files = [ thread . file , ... thread . replies . map ( ( i ) => i ?. file ) ] . filter (
( i ) => i != null
) ;
console . log ( files ) ;
} ) ( ) ;
Ese pequeño guión observa el hilo en busca de nuevas respuestas.
const { fchf } = require ( "4chan-full" ) ;
( async ( ) => {
let watcher = fchf . threadWatcher ( "vg" , "337012489" ) ;
// Events: updated, nowUpdated, checked, error, #start, #stop
watcher . on ( "updated" , ( oldThread , newThread ) => {
console . log ( { oldThread , newThread } ) ;
} ) ;
watcher . on ( "notUpdated" , ( ) => {
console . log ( "there is no new replies.." ) ;
} ) ;
watcher . on ( "checked" , ( oldThread , newThread ) => {
console . log ( "checked new checkInterval:" , watcher . checkInterval ) ;
} ) ;
watcher . start ( ) ;
} ) ( ) ;