sxiii icon

AliExpress Price Parsing with Perl

sxiii | PRO | 03/24/17 09:59:10 PM UTC | 0 ⭐ | 932 👁️ | Never ⏰ | []
Perl |

1.07 KB

|

None

|

0 👍

/

0 👎

# You have to install HTML::TagParser and also URI::Fetch
# For example do: sudo cpan URI::Fetch
# And then also do: sudo cpan HTML::TagParser
# Save this script as perlparse.pl and run perl ./perlparse.pl
# Good luck ;)
# Written 25.03.2017 by Security XIII
 
use HTML::TagParser;
my $url = "https://ru.aliexpress.com/item/6-12Colors-Non-toxic-Crayon-edible-baby-drawing-Supplies-ring-toy-Easy-to-erase-educational-toys/32753968959.html";
my $tag = "j-sku-discount-price";
 
    my $html = HTML::TagParser->new( $url );
    my @list = $html->getElementById( $tag );
    print @list[0]->innerText;
 
# In case you want to print all search results
#    foreach my $elem ( @list ) {
#        my $tagname = $elem->tagName;
#        my $attr = $elem->attributes;
#        my $text = $elem->innerText;
#        print "<$tagname";
#        foreach my $key ( sort keys %$attr ) {
#            print " $key=\"$attr->{$key}\"";
#        }
#        if ( $text eq "" ) {
#            print " />\n";
#        } else {
#            print ">$text</$tagname>\n";
#        }
#    }

Comments