Skip to content

Instantly share code, notes, and snippets.

@israel24961
Last active July 21, 2023 08:35
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 israel24961/d7350988a910afac3e553474b0475333 to your computer and use it in GitHub Desktop.
Save israel24961/d7350988a910afac3e553474b0475333 to your computer and use it in GitHub Desktop.
Número de empleos Infojobs por palabra clave - Number of infojobs jobs per keyword. Sequentially generated
##!/bin/sh
#
total_Infojobs() {
ntotal=$(jq -rn --arg x "$1" '$x|@uri' |xargs -I{} curl 'https://www.infojobs.net/webapp/offers/search?keyword='"{}"'&normalizedJobTitleIds=&provinceIds=&cityIds=&teleworkingIds=&categoryIds=&workdayIds=&educationIds=&segmentId=&contractTypeIds=&page=1&sortBy=PUBLICATION_DATE&onlyForeignCountry=false&countryIds=&sinceDate=ANY&subcategoryIds=' \
-H 'authority: www.infojobs.net' \
-H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8' \
-H 'accept-language: en-US,en;q=0.9' \
-H 'sec-ch-ua: "Not.A/Brand";v="8", "Chromium";v="114", "Brave";v="114"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: "LaRataDe2Patas"' \
-H 'sec-fetch-dest: document' \
-H 'sec-fetch-mode: navigate' \
-H 'sec-fetch-site: none' \
-H 'sec-fetch-user: ?1' \
-H 'sec-gpc: 1' \
-H 'upgrade-insecure-requests: 1' \
-H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36' \
--compressed -s | grep -i -o -P "totalelements\":.{0,10},"| head -n 1 | tr -d 'totalElements":,')
echo "$1:$ntotal"
}
#The cookies aren't mine, the query didn't go through without them,
#didn't give it too much thought, tho.
total_Indeed(){
ntotal=$( jq -rn --arg x "$1" '$x|@uri' |xargs -I{} curl 'https://es.indeed.com/jobs?q='"{}"'&l=' \
-H 'authority: es.indeed.com' \
-H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8' \
-H 'accept-language: en-US,en;q=0.6' \
-H 'cookie: __cf_bm=6iY3F3nmq3HpxyBSHJdoeA82MtM5i3IokuuAHT670WQ-1689927187-0-AV1VBA3ImbIOk/h8SLWa7zj12nUzHNayQe7zg3zmA6zPbuXB/oZOcC+EiGVaNbpIMXe6BqimXc0RV/cKWdr/1PI=; _cfuvid=34hJJ8H97gTEXlzlnsoMdTDDLv41UAr0pkz._cyLgoA-1689927187278-0-604800000; CTK=1h5ro4uv5gb4r800; CSRF=Exy1NsX0B3FNXFn8gF31yrrgML5whyTq; CF_BOTS-179=1; INDEED_CSRF_TOKEN=hrIQJvWbZb7lAJz8EfL9BHDsgdKevXdv; LV="LA=1689927187:CV=1689927187:TS=1689927187"; hpnode=1; SURF=jfeyYrjqEqkikcNay01QuWzRy6a8izPc; indeed_rcc="LV:CTK:UD"; loctip=1; jaSerpCount=1; UD="LA=1689927190:CV=1689927190:TS=1689927190:SG=1a246dbd09dacfa46a9899c20e5bb6a7"; RQ="q=c%23&l=&ts=1689927190048"; ac=bpN+YCeeEe6SI2cWOM/bgA#bpPMgCeeEe6SI2cWOM/bgA; JSESSIONID=F1D26C23DDF8CD0953A87B99257F2699; PTK=tk=1h5ro51fpjv5d800&type=jobsearch&subtype=topsearch' \
-H 'referer: https://es.indeed.com/jobs' \
-H 'sec-ch-ua: "Not.A/Brand";v="8", "Chromium";v="114", "Brave";v="114"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: "Linux"' \
-H 'sec-fetch-dest: document' \
-H 'sec-fetch-mode: navigate' \
-H 'sec-fetch-site: same-origin' \
-H 'sec-fetch-user: ?1' \
-H 'sec-gpc: 1' \
-H 'upgrade-insecure-requests: 1' \
-H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36' \
-s --compressed | sed -n '7p'| sed -e 's/.*content="//' -e 's/empleos.*//')
echo "$1:$ntotal"
}
echo "Infojobs"
for arg in "$@"; do
printf "$(total_Infojobs $arg) vs " & #remove & for determinism
done
wait
printf "\b\b\b \nIndeed\n"
for arg in "$@"; do
printf "$(total_Indeed $arg) vs " & #remove & for determinism
done
wait
printf "\b\b\b \n"
@israel24961
Copy link
Author

Sequential
res

Parallel
2023-07-21_5xJul_015

@israel24961
Copy link
Author

Infojobs, Indeed without &
res

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