Skip to content

Instantly share code, notes, and snippets.

@llaine
Last active November 5, 2018 22:58
Show Gist options
  • Save llaine/7696725 to your computer and use it in GitHub Desktop.
Save llaine/7696725 to your computer and use it in GitHub Desktop.
An algorithm which will automatically visit profiles on a dating site. In particular in adopteunmec.com. This algorithm has been written in bash.
#!/bin/bash
# @contact: darksioul6@gmail.com
# Enjoy
if [[ ! -e "config" ]]; then
echo "Entrez les informations correspondantes : "
echo -ne "Username : " ; read -r u
echo -ne "Mot de passe : " ; read -r p
echo -ne "L'age minimum : " ; read -r amin
echo -ne "L'age maximum : " ; read -r amax
echo -ne "Nombre de profil à visiter : " ; read -r c
echo "$u-delim-$p-delim-$amin-delim-$amax-delim-$c" >> config
echo "CONFIG .... OK"
fi
username=$(awk -F '-delim-' '{print $1}' config)
password=$(awk -F '-delim-' '{print $2}' config)
ageMin=$(awk -F '-delim-' '{print $3}' config)
ageMax=$(awk -F '-delim-' '{print $4}' config)
count=$(awk -F '-delim-' '{print $5}' config)
echo "CURRENT SETUP "
echo "================="
echo "user: $username"
echo "ageMin: $ageMin"
echo "ageMax: $ageMax"
echo "count: $count"
connexUrl="http://www.adopteunmec.com//auth/login"
searchUrl="http://www.adopteunmec.com/api/users?count=$count&age[min]=$ageMin&age[max]=$ageMax&age_step=1&by=region&country=fr&region=17&subregion[]=6&subregion[]=4&subregion[]=13&subregion[]=5&subregion[]=101&subregion[]=84&subregion[]=85&distance[min]=&distance[max]=0&distance_step=10&sex=1"
#La connexion avec les cookies
thisConnex="wget -O/dev/null -q --user-agent=Mozilla/5.0 --save-cookies cookies --post-data "username=$username\&password=$password" --no-check-certificate $connexUrl"
#La ligne qui récupère la recherche
search=$(curl -s -c cookies -u $username:$password -g "$searchUrl")
pseudo=$(echo "$search" | grep 'pseudo":"' | tr ',' "\n" | grep 'pseudo' | cut -d '"' -f 4)
ref=$(echo "$search" | grep '$ref":"' | tr ',' "\n" | grep '$ref' | cut -d '"' -f 4)
profileId=$(echo $ref | egrep -o '[[:digit:]]{8}')
profileCount=$(echo $profileId | wc -w )
i=0
echo "$profileCount trouvé"
echo "Starting ...."
echo -ne "["
for profile in $profileId; do
# TODO : Changer pour le profile
this=$(wget -O/dev/null -q --user-agent=Mozilla/5.0 --load-cookies cookies --no-check-certificate http://www.adopteunmec.com/profile/$profile)
echo -ne "#"
((i++))
done
echo -n "]"
printf "\n"
echo "$i profil visité"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment