Skip to content

Instantly share code, notes, and snippets.

@grillermo
Last active December 31, 2016 01:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grillermo/3d27e984dee896142e8a7c79ddeb3030 to your computer and use it in GitHub Desktop.
Save grillermo/3d27e984dee896142e8a7c79ddeb3030 to your computer and use it in GitHub Desktop.
You can't export from all your companies in facturify and you cant scrape in automated fashion due to the captcha so you have to use a browser based scraper such artoo.js
aliadas_urls = [
{
url: 'https://client.facturify.com/models/multiempresa.php?type=defecto&id=12',
data: {
multi: 288, // ID of the company
},
},
]
artoo.ajaxSpider(
aliadas_urls,
{
jquerify: true,
throttle: 100,
method: 'post',
process: function(data){
urls = []
// Target with jquery the invoices you want
data.find("form[name=form1] td:contains(PUBLICO EN GENERAL)").parent('tr').find('a[href*=2016-12]').each(function(){
url = $(this).attr('href')
urls.push(url)
})
return urls;
}
},
function(data) {
flattened_data = Array.prototype.concat.apply([], data)
artoo.saveJson(flattened_data, {filename: 'facturas-de-aliadas.json'});
}
);
@grillermo
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment