[piczel] fix extraction for single images

This commit is contained in:
Mike Fährmann
2020-03-31 22:47:23 +02:00
parent 699036ea0c
commit c034159701

View File

@@ -10,7 +10,6 @@
from .common import Extractor, Message
from .. import text
import json
class PiczelExtractor(Extractor):
@@ -137,8 +136,5 @@ class PiczelImageExtractor(PiczelExtractor):
self.image_id = match.group(1)
def posts(self):
url = "{}/gallery/image/{}".format(self.root, self.image_id)
page = self.request(url).text
data = json.loads(text.extract(
page, 'window.__PRELOADED_STATE__ =', '</script>')[0])
return (data["gallery"]["images"]["byId"][self.image_id],)
url = "{}/api/gallery/{}".format(self.root, self.image_id)
return (self.request(url).json(),)