1
0
mirror of https://github.com/balkian/bitter.git synced 2024-12-22 08:28:12 +00:00
bitter/bin/extract-media.sh
J. Fernando Sánchez 53bb7edabc Add sh scripts
2018-03-19 14:35:07 +01:00

17 lines
443 B
Bash
Executable File

if [ "$#" -lt 1 ]
then
echo "Usage: $0 <files to convert>"
exit 1
fi
export QUERY='select(.id != null) | .id_str as $id | .entities.urls[] | select(.expanded_url | select(. != null) | contains("open.spotify") or contains("youtube.com") or contains("youtu.be")) | [$id, .expanded_url] | @csv'
export FIELDS="id,url"
for i in "$@"
do
OUTPUT=$i.media.csv
echo $FIELDS > $OUTPUT
pv -N "$i media" -l $i | jq -r "$QUERY" >> $OUTPUT
done