]> CyberLeo.Net >> Repos - CDN/taggery.git/blob - lib/profiles/atfbooru.sh
Add rule34xxx and atfbooru profiles
[CDN/taggery.git] / lib / profiles / atfbooru.sh
1 atfbooru_can_handle() {
2   local url="${1}"
3   echo "${url}" | grep -qi 'booru.allthefallen.moe/posts/[0-9]*' || return 1
4   taggery_id_filter=atfbooru_id_filter
5   taggery_fmturl="https://booru.allthefallen.moe/posts/%s"
6   taggery_image_url_filter=atfbooru_image_url_filter
7   taggery_image_tags_filter=atfbooru_image_tags_filter
8 }
9 atfbooru_id_filter() {
10   sed -e 's#^.*/posts/\([0-9]\+\)\($\|/.*$\)#\1#'
11 }
12 atfbooru_image_url_filter() {
13   sed -e '/Size: /!d; s/^.*<a //i; s/^.*href="\([^"]*\)".*$/\1/i'
14 }
15 atfbooru_image_tags_filter() {
16   sed -e '/class="search-tag"/!d; s/<\/li>/&\n/g' | sed -e '/class="search-tag/!d; s/\([^?]\)<\/a>.*$/\1/; s/^.*>//; s/ /_/g'
17 }