The little things give you away... A collection of various small helper stuff
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

21 lines
737 B

  1. #!/bin/bash
  2. # Reads a wiki page in the new-style viewer format from stdin, runs everything that looks like a website through website-extract-social-media, and formats the output accordingly
  3. scriptpath="$(cd "$(dirname "$0")"; pwd -P)"
  4. while read -r line
  5. do
  6. echo "${line}"
  7. if [[ "${line}" == '* http://'* || "${line}" == '* https://'* ]]
  8. then
  9. url="${line:2}"
  10. if [[ "${url}" == *' | '* ]]
  11. then
  12. url="${url%% | *}"
  13. fi
  14. if ! grep -Pq '//(www\.)?(facebook\.com|flickr\.com|instagram\.com|twitter\.com|vk\.com|youtube\.com|youtu\.be)/' <<<"${url}"
  15. then
  16. "${scriptpath}/website-extract-social-media" "${url}" < <(:) | sed 's,^\(https\?://\(www\.\)\?\(.*\)\)$,\3 \1,' | sort | awk '{ print $2 }' | sed 's,^,* ,'
  17. fi
  18. fi
  19. done