The little things give you away... A collection of various small helper stuff
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 

21 lignes
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