Home > Bash > Bebiko Junior competition (bebiklub.pl)

Bebiko Junior competition (bebiklub.pl)

Friend of mine participate in competition on bebiklub.pl – just a simple vote system. Unfortunately I can’t see on which place she is, there is no such a functionality, so I need to implement it by myself. As usual I choice php for that:

<?php
for($z=0;$z<=2960;$z=$z+10){
$url='https://www.bebiklub.pl/home/nowe-bebiko-junior/odpowiedzi-konkursowe/?start='.$z;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
$in = curl_exec($ch);
curl_close($ch);

preg_match_all('/data-votes="(.*)" data-name="(.*)" data-id/i', $in, $out);
$k=count($out[1]);
for($i=0;$i<=$k-1;$i++){
        echo $out[2][$i].';';
        echo $out[1][$i]."\n";
}
}
?>

It will output a list of nicknames and votes in format:
nick;number_of_votes
Afterwards that output can be imported to excel and sorted.

Btw. Don’t forget to vote!

Categories: Bash
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: