GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — shell-script/065-moviedata.sh at master · srinivart/shell-script

Expand file tree

/

065-moviedata.sh

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
executable file
·
52 lines (40 loc) · 1.24 KB
/

065-moviedata.sh

Copy path

File metadata and controls

executable file
·
52 lines (40 loc) · 1.24 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/sh
# moviedata - given a movie title, return a list of matches, if
# there's more than one, or a synopsis of the movie if there's
# just one. Uses the Internet Movie Database (imdb.com)
imdburl="http://us.imdb.com/Tsearch?restrict=Movies+only&title="
titleurl="http://us.imdb.com/Title?"
tempout="/tmp/moviedata.$$"
summarize_film()
{
# produce an attractive synopsis of the film
grep "^<title>" $tempout | sed 's/<[^>]*>//g;s/(more)//'
grep '<b class="ch">Plot Outline:</b>' $tempout | \
sed 's/<[^>]*>//g;s/(more)//;s/(view trailer)//' |fmt|sed 's/^/ /'
exit 0
}
trap "rm -f $tempout" 0 1 15
if [ $# -eq 0 ] ; then
echo "Usage: $0 {movie title | movie ID}" >&2
exit 1
fi
fixedname="$(echo $@ | tr ' ' '+')" # for the URL
if [ $# -eq 1 ] ; then
nodigits="$(echo $1 | sed 's/[[:digit:]]*//g')"
if [ -z "$nodigits" ] ; then
lynx -source "$titleurl$fixedname" > $tempout
summarize_film
fi
fi
url="$imdburl$fixedname"
lynx -source $url > $tempout
if [ ! -z "$(grep "IMDb title search" $tempout)" ] ; then
grep 'HREF="/Title?' $tempout | \
sed 's/<OL><LI><A HREF="//;s/<\/A><\/LI>//;s/<LI><A HREF="//' | \
sed 's/">/ -- /;s/<.*//;s/\/Title?//' | \
sort -u | \
more
else
summarize_film
fi
exit 0
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.