"):
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)
def _extract_files_download(self, page, files):
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"] = "download"
files.append(file)
def _extract_files_gallery(self, page, files):
for gallery in text.extract_iter(
page, ""):
url = self.root + "/api/creator/gallery/images"
params = {
"hash" : text.extr(gallery, ' hash="', '"'),
"gallery_id": text.extr(gallery, ' gallery-id="', '"'),
"time" : text.extr(gallery, ' time="', '"'),
}
data = self.request(url, params=params).json()
url = self.root + "/api/creator/gallery/imagePath"
for params["page"], params["file_id"] in enumerate(
data["imgList"]):
path = self.request(url, params=params).json()["path"]
file = params.copy()
file["url"] = path
files.append(file)
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