1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-25 12:12:34 +01:00

[fappic] add 'image' extractor (closes #1898)

This commit is contained in:
Mike Fährmann 2021-09-28 23:35:29 +02:00
parent c22ff97743
commit e0bdacd932
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
3 changed files with 29 additions and 2 deletions

View File

@ -181,6 +181,12 @@ Consider all sites to be NSFW unless otherwise known.
<td>Creators, Posts</td> <td>Creators, Posts</td>
<td><a href="https://github.com/mikf/gallery-dl#cookies">Cookies</a></td> <td><a href="https://github.com/mikf/gallery-dl#cookies">Cookies</a></td>
</tr> </tr>
<tr>
<td>Fappic</td>
<td>https://fappic.com/</td>
<td>individual Images</td>
<td></td>
</tr>
<tr> <tr>
<td>Flickr</td> <td>Flickr</td>
<td>https://www.flickr.com/</td> <td>https://www.flickr.com/</td>

View File

@ -279,3 +279,23 @@ class ImgclickImageExtractor(ImagehostImageExtractor):
url , pos = text.extract(page, '<br><img src="', '"') url , pos = text.extract(page, '<br><img src="', '"')
filename, pos = text.extract(page, 'alt="', '"', pos) filename, pos = text.extract(page, 'alt="', '"', pos)
return url, filename return url, filename
class FappicImageExtractor(ImagehostImageExtractor):
"""Extractor for single images from fappic.com"""
category = "fappic"
pattern = r"(?:https?://)?((?:www\.)?fappic\.com/(\w+)/[^/?#]+)"
test = ("https://www.fappic.com/98wxqcklyh8k/test.png", {
"pattern": r"https://img\d+\.fappic\.com/img/\w+/test\.png",
"keyword": "433b1d310b0ff12ad8a71ac7b9d8ba3f8cd1e898",
"content": "0c8768055e4e20e7c7259608b67799171b691140",
})
def get_info(self, page):
url , pos = text.extract(page, '<a href="/?click"><img src="', '"')
filename, pos = text.extract(page, 'alt="', '"', pos)
if filename.startswith("Porn-Picture-"):
filename = filename[13:]
return url, filename

View File

@ -17,7 +17,8 @@ import hashlib
import datetime import datetime
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from gallery_dl import extractor, util, job, config, exception # noqa E402 from gallery_dl import \
extractor, util, job, config, exception, formatter # noqa E402
# temporary issues, etc. # temporary issues, etc.
@ -262,7 +263,7 @@ class TestPathfmt():
return 0 return 0
class TestFormatter(util.Formatter): class TestFormatter(formatter.StringFormatter):
@staticmethod @staticmethod
def _noop(_): def _noop(_):