mgdm / htmlq

Like jq, but for HTML.
MIT License
7k stars 107 forks source link

htmlq does not work with cron #25

Open MarioShatterhand opened 2 years ago

MarioShatterhand commented 2 years ago

Hello. I have found a bug that happens when I try to use HTMLq with curl in cron job. Same script that works well when run from console, in cron job returns nothing. Empty text. How to reproduce: in python:

import subprocess

command = 'curl --silent https://pwsztar.edu.pl/instytut-politechniczny/informatyka/harmonogramy/ | htmlq "#rozmCZ > p:nth-child(8)"'

ret = subprocess.run(command, capture_output=True, shell=True)
print(ret.stdout.decode('UTF-8'))

in bash script:

#!/bin/bash

variable=$(curl --silent https://pwsztar.edu.pl/instytut-politechniczny/informatyka/harmonogramy/ | htmlq "#rozmCZ > p:nth-child(8)")

echo "$variable"
pbsds commented 1 year ago

Does the cronhob have htmlq in PATH? Usually you use the full paths in cron. Get the full path of htmlq by running command -v htmlq