[foolfuuka] ensure sorted posts
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
from .common import Extractor, Message
|
||||
from .. import text
|
||||
import itertools
|
||||
import operator
|
||||
|
||||
|
||||
class ChanThreadExtractor(Extractor):
|
||||
@@ -101,4 +102,9 @@ class FoolfuukaThreadExtractor(Extractor):
|
||||
url = self.root + "/_/api/chan/thread/"
|
||||
params = {"board": self.board, "num": self.thread}
|
||||
data = self.request(url, params=params).json()[self.thread]
|
||||
return itertools.chain((data["op"],), data["posts"].values())
|
||||
|
||||
# sort post-objects by their key
|
||||
posts = sorted(data["posts"].items(), key=operator.itemgetter(0))
|
||||
posts = map(operator.itemgetter(1), posts)
|
||||
|
||||
return itertools.chain((data["op"],), posts)
|
||||
|
||||
@@ -311,7 +311,7 @@ class DeviantartJournalExtractor(DeviantartExtractor):
|
||||
r"/(?:journal|blog)/?(?:\?catpath=/)?$"]
|
||||
test = [
|
||||
("http://shimoda7.deviantart.com/journal/", {
|
||||
"url": "b1a3460e7da0f34c8f6c286a3b5428fd4d3bc64b",
|
||||
"url": "f7960ae06e774d6931c61ad309c95a10710658b2",
|
||||
"keyword": "6444966c703e63470a5fdd8f460993b68955c32c",
|
||||
}),
|
||||
("http://shimoda7.deviantart.com/journal/?catpath=/", None),
|
||||
|
||||
Reference in New Issue
Block a user