[fansly] implement 'home' extractor (#4401)
This commit is contained in:
@@ -96,11 +96,18 @@ class FanslyPostExtractor(FanslyExtractor):
|
|||||||
|
|
||||||
class FanslyHomeExtractor(FanslyExtractor):
|
class FanslyHomeExtractor(FanslyExtractor):
|
||||||
subcategory = "home"
|
subcategory = "home"
|
||||||
pattern = rf"{BASE_PATTERN}/home(?:/(subscribed|list/(\d+)))?"
|
pattern = rf"{BASE_PATTERN}/home(?:/(?:subscribed()|list/(\d+)))?"
|
||||||
example = "https://fansly.com/home"
|
example = "https://fansly.com/home"
|
||||||
|
|
||||||
def items(self):
|
def posts(self):
|
||||||
pass
|
subscribed, list_id = self.groups
|
||||||
|
if subscribed is not None:
|
||||||
|
mode = "1"
|
||||||
|
elif list_id is not None:
|
||||||
|
mode = None
|
||||||
|
else:
|
||||||
|
mode = "0"
|
||||||
|
return self.api.timeline_home(mode, list_id)
|
||||||
|
|
||||||
|
|
||||||
class FanslyListExtractor(FanslyExtractor):
|
class FanslyListExtractor(FanslyExtractor):
|
||||||
@@ -149,6 +156,15 @@ class FanslyAPI():
|
|||||||
params = {"ids": post_id}
|
params = {"ids": post_id}
|
||||||
return self._update_posts(self._call(endpoint, params))
|
return self._update_posts(self._call(endpoint, params))
|
||||||
|
|
||||||
|
def timeline_home(self, mode="0", list_id=None):
|
||||||
|
endpoint = "/v1/timeline/home"
|
||||||
|
params = {"before": "0", "after": "0"}
|
||||||
|
if list_id is None:
|
||||||
|
params["mode"] = mode
|
||||||
|
else:
|
||||||
|
params["listId"] = list_id
|
||||||
|
return self._pagination(endpoint, params)
|
||||||
|
|
||||||
def timeline_new(self, account_id, wall_id):
|
def timeline_new(self, account_id, wall_id):
|
||||||
endpoint = f"/v1/timelinenew/{account_id}"
|
endpoint = f"/v1/timelinenew/{account_id}"
|
||||||
params = {
|
params = {
|
||||||
|
|||||||
@@ -25,4 +25,19 @@ __tests__ = (
|
|||||||
"#class" : fansly.FanslyCreatorPostsExtractor,
|
"#class" : fansly.FanslyCreatorPostsExtractor,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"#url" : "https://fansly.com/home",
|
||||||
|
"#class" : fansly.FanslyHomeExtractor,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"#url" : "https://fansly.com/home/subscribed",
|
||||||
|
"#class" : fansly.FanslyHomeExtractor,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"#url" : "https://fansly.com/home/list/1234567890",
|
||||||
|
"#class" : fansly.FanslyHomeExtractor,
|
||||||
|
},
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user