Skip to content

Instantly share code, notes, and snippets.

my $data_keys = {
key1 => {
field0 => "",
field1 => "",
field2 => "",
field3 => "",
field4 => "",
field5 => "",
field6 => "",
},
use common::sense;
use Web::Scraper;
my $csv = '';
my $dom = scraper{
process 'div.desc-container', 'site[]' => scraper {
process 'span.topsites-label', 'domain' => 'TEXT';
process 'h2 a', 'name' => 'TEXT';
}};
{
"total": 22,
"result": [
{
"link": "www.americanas.com.br/produto/240471",
"name": "Livro - Trust",
"image": "http://img.americanas.com.br/produtos/01/00/item/240/4/240471P1.jpg",
"stores": 1,
"offers": 1,
"best_price": 56.7,
wget http://ftp.postgresql.org/pub/source/v9.3.1/postgresql-9.3.1.tar.gz
tar -xf postgresql-9.3.1.tar.gz
sudo apt-get install libreadline-dev
sudo apt-get install zlib1g-dev
cd postgresql-9.3.1/
./configure
sudo su
make install
adduser postgres
mkdir /usr/local/pgsql/data
#!/usr/bin/env perl
package Store::Americanas::Category::Spider;
use Log::Log4perl qw(:easy);
use Time::Out qw(timeout);
use use qw/ common::sense DDP Moo MooX::late
YADA Web::Scraper URI WWW::UserAgent::Random
Redis
Parallel::ForkManager List::MoreUtils DateTime DateTime::Format::Strptime
/;
perl -MDateTime -E'
my %cvd = map { $b = 9+ord$_; $b>100 ? $b-70 : $b-64 => $_ } "A".."Z", "a".."z";
say f_dt( DateTime->now->set_time_zone("America/Sao_Paulo"));
sub f_dt{
my ($dt) = shift;
$dt =~ s/[:T\-]|^.{4}|.{2}$//go;
return join "", map { $cvd{$_} // $_+0 } unpack("A2 A2 A2 A2", $dt)
}
'
{
"sku": "Sony_HD-E1_Preto",
"name": "HD Externo de 500GB Sony - HD-EG5 Preto",
"brand": "Sony",
"details": {
"Tamanho de disco": " 2.5 polegadas.",
"Compatibilidade": " Windows® 8 (32bit/64bit) / Windows® 8 Pro (32bit/64bit) / Windows 7 (32 bit/64bit)/ Windows Vista / Windows XP (32 BIT)/ Mac OS* X 10.4 ou superior *Mac OS suporta apenas USB 2.0.",
"Acessórios fornecidos": " Acelerador de Transferência de Dados*, Gerenciador de backup*, Gerenciador de Proteção por Senhas*, Formatador FAT 32* - *Software para PC apenas para Windows.",
"Velocidade de transferência": " Máx. 5Gbps (USB 3.0), Máx. 480 Mbps (USB 2.0).",
"Capacidade utilizável": " 465 GB.",
<?xml version="1.0" encoding="UTF-8"?>
<products>
<product>
<identifier>1020304_SAO_FOR</identifier>
<fn>Jericoacoara e Fortaleza - 8 dias</fn>
<description>Jericoacoara pode ser chamada de paraíso ecológico. Mesmo sua fama correndo o mundo, Jeri, como é conhecida, continua com ar de lugar intocado.</description>
<category>Nacional</category>
<category>Sao Paulo</category>
<category>Fortaleza</category>
<brand></brand>