Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- for file in **/*.htm; do
- net=$(
- pup -f "$file" 'tr:parent-of(th:contains("岩手県"))' \
- | pup 'span.blue, span.limegreen, span.red'
- )
- if [[ -n "$net" ]]; then
- title=$(pup -f "$file" -p 'title text{trim}')
- air_date=$(
- perl -lnE '/放映期間:(\d{2})\.(\d{2})\.(\d{2})/
- and print "19$1-$2-$3" and exit' "$file"
- )
- air_time='N/A'
- class=$(pup 'span attr{class}' <<< "$net")
- if [[ "$class" == "blue" ]]; then
- delay='同時'
- air_time=$(perl -lnE '/放映時間:(.+?)<BR>/ and print $1 and exit' "$file")
- elif [[ "$class" == "limegreen" ]]; then
- delay='遅れ'
- else
- delay='終了後'
- fi
- broadcaster=$(
- pup -p 'span text{trim}' <<< "$net" \
- | perl -lnE '/\((.+?)\)/ and print $1'
- )
- printf '%s\t%s\tN/A\t%s\t%s\t%s\n' \
- "$air_date" "$title" "$air_time" "$delay" "$broadcaster"
- fi
- done
Advertisement
Add Comment
Please, Sign In to add comment