1
0
mirror of https://github.com/balkian/bitter.git synced 2024-12-22 16:38:13 +00:00
bitter/bin/extract-media.sh

17 lines
443 B
Bash
Raw Normal View History

2018-03-19 13:35:07 +00:00
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