Skip to content

Instantly share code, notes, and snippets.

View Cshion's full-sized avatar
🏠
Working from home

Aaron Castillo Cshion

🏠
Working from home
View GitHub Profile
@Cshion
Cshion / index.js
Last active May 5, 2023 16:47
Usando el WS de SUNAT para enviar una factura con Nodejs
var soap = require('soap');
var fs = require('fs');
var http = require('http');
var url = 'https://e-beta.sunat.gob.pe/ol-ti-itcpfegem-beta/billService?wsdl';
var options = {
forceSoap12Headers: false
};
var data = fs.readFileSync("./20532710066-01-F001-1.zip",{
encoding:"base64"
@Cshion
Cshion / reniec.js
Created September 25, 2016 21:51
Reniec scraper.
"use strict";
const request = require("request");
const dv = require("dv");
const async = require("async");
const fs = require("fs");
const cheerio = require("cheerio");
const CAPTCHA_URL = "https://cel.reniec.gob.pe/valreg/codigo.do";
const DATA_URL = "https://cel.reniec.gob.pe/valreg/valreg.do";
var request = require("request");
var URL = "http://11.17.25.172:8090/intico/weurces/envioSMS/sms";
request.post(URL , {
form : {
usuario : "value1" ,
password : "value2" ,
celular : "value3" ,
mensaje : "value4" ,
senderId : "value5"
@Cshion
Cshion / votoinformado.js
Created June 12, 2016 19:33
Obtiene informacion de la persona recibiendo como parametro el dni , hasta que no se bajen la pagina web.
var request = require("request");
var cheerio = require("cheerio");
var TARGET = "http://www.votoinformado.pe/voto/miembro_mesa.aspx";
function getPage(dni , callback) {
var data = {
"__EVENTTARGET" : "btnCongrDNI" ,
"__EVENTARGUMENT" : "" ,
@Cshion
Cshion / studio92-envivo-scraper.js
Created May 18, 2016 16:44
Scrape para sacar la musica que se escucha actualmente en la radio desde la pagina web
var cheerio = require("cheerio");
var request = require("request");
var STUDIO_EN_VIVO = "http://www.studio92.com/musiconair.php";
function getOnAir( callback ) {
request.get({ url : STUDIO_EN_VIVO , timeout : 5000 } , function ( err , response , body ) {
if ( err ) {
@Cshion
Cshion / sbs-tipocambio.js
Last active May 17, 2016 16:34
Scrape basico de la pagina de la Superintendencia de Banca y seguros para sacar el tipo de cambio vigente.
var request = require("request");
var cheerio = require("cheerio");
var URL_TARGET = "http://www.sbs.gob.pe/app/stats/tc-cv.asp";
function parseDom( html , cb ) {
try {
var $ = cheerio.load(html);
var table = $("table.APLI_tabla").first().children("tr")
var data = table.map(function ( index ) {
@Cshion
Cshion / rae.js
Created February 19, 2016 17:32
Basic DRAE scrapper , need refactor to manage redirections.
var request = require( "request" );
var cheerio = require( "cheerio" );
var async = require( "async" );
var getHtml = function( word , callback ) {
var BASE_URL = "http://dle.rae.es/srv/search";
request( {
uri : BASE_URL ,
qs : {
w : word ,