20 lines
		
	
	
		
			621 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
		
			621 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
| #!/usr/bin/env bash
 | |
| [ -f functions.sh ] && source functions.sh
 | |
| 
 | |
| # Dependencies required by this module
 | |
| dependencies=("curl" "w3m" "grep" "iconv")
 | |
| 
 | |
| # Check dependencies before running
 | |
| if ! check_dependencies "${dependencies[@]}"; then
 | |
|     msg "$2" "$1: This module requires: ${dependencies[*]}"
 | |
|     exit 1
 | |
| fi
 | |
| 
 | |
| fml="$(curl -Ls --connect-timeout 5 https://fmylife.com/random | grep -m1 -A1 '<a class="article-link" href="/article/.*>' | tail -1 | w3m -dump -T text/html | iconv -f utf-8 -t ascii | tr '[:space:]' ' ')"
 | |
| 
 | |
| if [[ ${#fml} -gt 10 ]]; then
 | |
|     msg "$2" "${fml}"
 | |
| else
 | |
|     msg "$2" "I couldn't get any fmls. fml"
 | |
| fi
 |