| 1 |
|
| 2 |
|
| 3 |
n |
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
"""Extractors for https://yourlesbians.com/""" |
| 10 |
|
| 11 |
from .common import GalleryExtractor |
| 12 |
from .. import text |
| 13 |
|
| 14 |
BASE_PATTERN = r"(?:https?://)?(?:www\.)?yourlesbians\.com" |
| 15 |
|
| 16 |
|
| 17 |
class YourlesbiansAlbumExtractor(GalleryExtractor): |
| 18 |
category = "yourlesbians" |
| 19 |
subcategory = "album" |
| 20 |
root = "https://yourlesbians.com" |
| 21 |
directory_fmt = ("{category}", "{title}") |
| 22 |
filename_fmt = "{num:>03} {filename}.{extension}" |
| 23 |
archive_fmt = "{title}/{num}" |
| 24 |
pattern = BASE_PATTERN + r"(/album/([^/?#]+)/?)" |
| 25 |
example = "https://yourlesbians.com/album/SLUG/" |
| 26 |
|
| 27 |
def metadata(self, page): |
| 28 |
extr = text.extract_from(page) |
| 29 |
data = { |
| 30 |
"album_url": extr('property="og:url" content="', '"'), |
| 31 |
"title": text.unescape(extr( |
| 32 |
'property="og:title" content="', '"')[:-8].rstrip()), |
| 33 |
"album_thumbnail": extr('property="og:image" content="', '"'), |
| 34 |
"description": extr('property="og:description" content="', '"'), |
| 35 |
"tags": text.split_html(extr('tags-row', '</div>'))[1:], |
| 36 |
} |
| 37 |
if data["description"].endswith(", right after."): |
| 38 |
data["description"] = "" |
| 39 |
self.album = extr('class="album-inner', "</div>") |
| 40 |
return data |
| 41 |
|
| 42 |
def images(self, _): |
| 43 |
results = [] |
| 44 |
for url in text.extract_iter(self.album, '<a href="', '"'): |
| 45 |
fn, _, ext = url.rsplit("/", 2)[1].rpartition(".") |
| 46 |
results.append((url, { |
| 47 |
"filename" : fn, |
| 48 |
"extension": ext, |
| 49 |
})) |
| 50 |
return results |