[fikfap] support main page post URLs (#9026)
* Update fikfap.py to allow for extracting a single post from the main page
Current post extractor only works on links to posts
on user pages but not on direct links to posts
* include 'singlepost' logic into existing 'post' extractor
---------
Co-authored-by: Mike Fährmann <mike_faehrmann@web.de>
This commit is contained in:
@@ -67,20 +67,17 @@ class FikfapExtractor(Extractor):
|
|||||||
|
|
||||||
class FikfapPostExtractor(FikfapExtractor):
|
class FikfapPostExtractor(FikfapExtractor):
|
||||||
subcategory = "post"
|
subcategory = "post"
|
||||||
pattern = BASE_PATTERN + r"/user/(\w+)/post/(\d+)"
|
pattern = BASE_PATTERN + r"/(?:user/\w+/)?post/(\d+)"
|
||||||
example = "https://fikfap.com/user/USER/post/12345"
|
example = "https://fikfap.com/user/USER/post/12345"
|
||||||
|
|
||||||
def posts(self):
|
def posts(self):
|
||||||
user, pid = self.groups
|
pid = self.groups[0]
|
||||||
|
|
||||||
url = f"{self.root_api}/profile/username/{user}/posts"
|
url = f"{self.root_api}/posts/{pid}"
|
||||||
params = {"amount" : "1", "startId": pid}
|
post = self.request_api(url, None)
|
||||||
posts = self.request_api(url, params)
|
|
||||||
|
|
||||||
pid = int(pid)
|
if post["postId"] == int(pid):
|
||||||
for post in posts:
|
return (post,)
|
||||||
if post["postId"] == pid:
|
|
||||||
return (post,)
|
|
||||||
raise exception.NotFoundError("post")
|
raise exception.NotFoundError("post")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,12 +13,12 @@ __tests__ = (
|
|||||||
"#class" : fikfap.FikfapPostExtractor,
|
"#class" : fikfap.FikfapPostExtractor,
|
||||||
"#pattern" : r"ytdl:https://vz-\w+-178\.b-cdn\.net/bcdn_token=.+/playlist\.m3u8",
|
"#pattern" : r"ytdl:https://vz-\w+-178\.b-cdn\.net/bcdn_token=.+/playlist\.m3u8",
|
||||||
|
|
||||||
"algorithm" : "user-posts",
|
"algorithm" : "single-post",
|
||||||
"bunnyVideoId" : "89218ae2-d79a-49a0-abcd-590fd70c9800",
|
"bunnyVideoId" : "89218ae2-d79a-49a0-abcd-590fd70c9800",
|
||||||
"commentsCount" : int,
|
"commentsCount" : int,
|
||||||
"createdAt" : "2025-10-21T00:49:00.306Z",
|
"createdAt" : "2025-10-21T00:49:00.306Z",
|
||||||
"date" : "dt:2025-10-21 00:49:00",
|
"date" : "dt:2025-10-21 00:49:00",
|
||||||
"date_updated" : "dt:2026-02-07 01:07:45",
|
"date_updated" : "type:datetime",
|
||||||
"deletedAt" : None,
|
"deletedAt" : None,
|
||||||
"duration" : None,
|
"duration" : None,
|
||||||
"explicitnessRating": None,
|
"explicitnessRating": None,
|
||||||
@@ -99,6 +99,20 @@ __tests__ = (
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"#url" : "https://fikfap.com/post/1429486",
|
||||||
|
"#class" : fikfap.FikfapPostExtractor,
|
||||||
|
"#pattern" : r"ytdl:https://vz-\w+-178\.b-cdn\.net/bcdn_token=.+/playlist\.m3u8",
|
||||||
|
|
||||||
|
"bunnyVideoId": "89218ae2-d79a-49a0-abcd-590fd70c9800",
|
||||||
|
"date" : "dt:2025-10-21 00:49:00",
|
||||||
|
"extension" : "mp4",
|
||||||
|
"filename" : "⬇️check my FREE VIP OF ⬇️",
|
||||||
|
"mediaId" : "b821619e-96a1-49a3-a3f8-a8a3e8432a51",
|
||||||
|
"postId" : 1429486,
|
||||||
|
"userId" : "32f4c8d6-2409-4db8-9e66-d3b5ff0c1a98",
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"#url" : "https://fikfap.com/user/alinevs",
|
"#url" : "https://fikfap.com/user/alinevs",
|
||||||
"#class" : fikfap.FikfapUserExtractor,
|
"#class" : fikfap.FikfapUserExtractor,
|
||||||
|
|||||||
Reference in New Issue
Block a user