2015-04-08 02:26:13 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2016-10-03 08:23:40 +02:00
|
|
|
# Copyright 2014-2016 Mike Fährmann
|
2015-04-08 02:26:13 +02:00
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License version 2 as
|
|
|
|
# published by the Free Software Foundation.
|
|
|
|
|
2016-09-12 10:20:57 +02:00
|
|
|
"""Extract images and videos from https://8ch.net/"""
|
2015-04-08 02:26:13 +02:00
|
|
|
|
2016-10-03 08:23:40 +02:00
|
|
|
from . import chan
|
2014-10-12 21:56:44 +02:00
|
|
|
|
2016-10-03 08:23:40 +02:00
|
|
|
class InfinitychanThreadExtractor(chan.ChanThreadExtractor):
|
2016-09-12 10:20:57 +02:00
|
|
|
"""Extractor for images from threads from 8ch.net"""
|
2015-11-21 03:13:06 +01:00
|
|
|
category = "8chan"
|
2016-10-15 23:06:54 +02:00
|
|
|
filename_fmt = "{time}-{filename}{ext}"
|
2015-11-21 03:13:06 +01:00
|
|
|
pattern = [r"(?:https?://)?(?:www\.)?8ch\.net/([^/]+)/res/(\d+)"]
|
2016-09-19 16:15:27 +02:00
|
|
|
test = [("https://8ch.net/tg/res/175887.html", {
|
2016-10-15 23:06:54 +02:00
|
|
|
"url": "646d4230b40f9cff3f8674e3efe44bba3af4924b",
|
2016-12-12 14:17:15 +01:00
|
|
|
"keyword": "923a6abc046cb618af8f9fd3bbb63c4cd6d73542",
|
2016-10-07 15:11:58 +02:00
|
|
|
"content": "81e21a3cc87f64f224a966f207e8e1731216c345",
|
2016-09-19 16:15:27 +02:00
|
|
|
})]
|
2015-09-07 16:32:20 +02:00
|
|
|
api_url = "https://8ch.net/{board}/res/{thread}.json"
|
2016-10-15 23:06:54 +02:00
|
|
|
file_url = "https://media.8ch.net/{board}/src/{tim}{ext}"
|
|
|
|
file_url_v2 = "https://media.8ch.net/file_store/{tim}{ext}"
|
|
|
|
|
|
|
|
def build_url(self, post):
|
|
|
|
fmt = self.file_url if len(post["tim"]) < 64 else self.file_url_v2
|
|
|
|
return fmt.format_map(post)
|