Advertisement
Guest User

Untitled

a guest
May 25th, 2015
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.85 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. readonly PRE="http://www.blob.rai.it/dl/RaiTV/programmi/media/"
  4. readonly POST=".html#p=0"
  5.  
  6.  
  7. #First URL from which it gets the "weekly" URL
  8. url=$(wget -O- blob.rai.it | grep -oP '=http.?://\S+' | sed 's/=//;s/">//');
  9.  
  10. #From the "weekly" URL it then filters 6 IDs
  11. paths=$(wget -O- $url | grep -A100 settimana | grep 'li id="C' | sed 's/" class=.*//' | sed -r 's/.{8}//')
  12.  
  13. echo "$PRE""${paths}""$POST"
  14.  
  15.  
  16. #I know need to create variables made of "something"+$entryFrom$paths"+somethingElse" and then pass these new urls to wget
  17.  
  18. # This is the line you suggested and im trying to adapt it
  19. while IFS=$'\n' read -d '' -ra pattern; do arr+=("$pattern"); done < <(wget -q -O- "$url" | grep "pattern"); printf '%s\n' "${arr[@]}"
  20.  
  21.  
  22.  
  23.  
  24. echo "URL="$url
  25.  
  26. echo $url > lista #just for testing
  27. ~
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement