"):
path = text.extr(video, ' base-path="', '"')
name = text.extr(video, ' file-name="', '"')
auth = text.extr(video, ' auth-key="', '"')
file = text.nameext_from_url(name)
file["url"] = "{}video-web.mp4?{}".format(path, auth)
file["type"] = "video"
files.append(file)
for download in text.extract_iter(
page, 'class="downloadBlock', ""):
name = text.extr(download, "", "<")
file = text.nameext_from_url(name.rpartition(" ")[0])
file["url"] = text.extr(download, ' href="', '"')
file["type"] = "attachment"
files.append(file)
return files
def _extract_galleries(self, page):
# TODO
files = []
for gallery in text.extract_iter(
page, ""):
url = "https://ci-en.dlsite.com/api/creator/gallery/images"
params = {
"hash" : text.extr(gallery, ' hash="', '"'),
"gallery_id": text.extr(gallery, ' gallery-id="', '"'),
"time" : text.extr(gallery, ' time="', '"'),
}
self.request(url, params=params)
return files
class CienCreatorExtractor(CienExtractor):
subcategory = "creator"
pattern = BASE_PATTERN + r"/creator/(\d+)(?:/article(?:\?([^#]+))?)?/?$"
example = "https://ci-en.net/creator/123"
def items(self):
url = "{}/creator/{}/article".format(self.root, self.groups[0])
params = text.parse_query(self.groups[1])
params["mode"] = "list"
return self._pagination_articles(url, params)
class CienRecentExtractor(CienExtractor):
subcategory = "recent"
pattern = BASE_PATTERN + r"/mypage/recent(?:\?([^#]+))?"
example = "https://ci-en.net/mypage/recent"
def items(self):
url = self.root + "/mypage/recent"
params = text.parse_query(self.groups[0])
return self._pagination_articles(url, params)
class CienFollowingExtractor(CienExtractor):
subcategory = "following"
pattern = BASE_PATTERN + r"/mypage/subscription(/following)?"
example = "https://ci-en.net/mypage/subscription"
def items(self):
url = self.root + "/mypage/subscription" + (self.groups[0] or "")
page = self.request(url).text
data = {"_extractor": CienCreatorExtractor}
for subscription in text.extract_iter(
page, 'class="c-grid-subscriptionInfo', ''):
url = text.extr(subscription, ' href="', '"')
yield Message.Queue, url, data