//RtReviewScraper function also takes in movieName and year(an optional argument) as arguments prints all the reviews
RtReviewScraper function also takes in movieName and year(an optional argument) as arguments prints all the reviews
// RtReviewScraper function also takes in movieName and year ( an optional argument ) as arguments prints all the reviews
func RtReviewScraper(mname string, year string) {
	movieName := strings.Replace(mname, " ", "_", 9)
	urlis := "https://www.rottentomatoes.com/m/" + movieName
	if len(year) == 4 {
		urlis = urlis + "_" + year
	}
	doc, err := goquery.NewDocument(urlis)
	if err != nil {
		fmt.Println("error Occurred!")
	}
	finder := doc.Find("#reviews .review_quote")
	if len(finder.Nodes) > 0 {
		fmt.Println(chalk.Magenta.NewStyle().WithTextStyle(chalk.Bold), "Reviews from RT!", chalk.Reset)
		doc.Find("#reviews .review_quote").Each(func(i int, s *goquery.Selection) {
			review := s.Find("p").Text()
			fmt.Println(strings.TrimSpace(review))
			fmt.Println(chalk.Magenta, "-------------------", chalk.Reset)
		})
	} else {
		fmt.Println("Looks like Rt also needs the year argument!")
	}
}
func RtReviewScraper ( mname string , year string ) { movieName := strings . Replace ( mname , " " , " " , 9 ) urlis := " " + movieName if len ( year ) == 4 { urlis = urlis + " " + year } doc , err := goquery . NewDocument ( urlis ) if err != nil { fmt . Println ( " " ) } finder := doc . Find ( " " ) if len ( finder . Nodes ) > 0 { fmt . Println ( chalk . Magenta . NewStyle ( ) . WithTextStyle ( chalk . Bold ) , " " , chalk . Reset ) doc . Find ( " " ) . Each ( func ( i int , s * goquery . Selection ) { review := s . Find ( " " ) . Text ( ) fmt . Println ( strings . TrimSpace ( review ) ) fmt . Println ( chalk . Magenta , " " , chalk . Reset ) } ) } else { fmt . Println ( " " ) } }
RtReviewScraper function also takes in movieName and year(an optional argument) as arguments prints all the reviews
RtReviewScraper function also takes in movieName and year ( an optional argument ) as arguments prints all the reviews