2015-04-08 02:26:13 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
# Copyright 2014, 2015 Mike Fährmann
|
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
|
|
|
|
"""Extract image- and video-urls from threads on https://8ch.net/"""
|
|
|
|
|
2015-09-07 16:32:20 +02:00
|
|
|
from .chan import ChanExtractor
|
2014-10-12 21:56:44 +02:00
|
|
|
|
2015-04-08 02:26:13 +02:00
|
|
|
info = {
|
|
|
|
"category": "8chan",
|
|
|
|
"extractor": "InfinityChanExtractor",
|
2015-09-07 16:32:20 +02:00
|
|
|
"directory": ["{category}", "{board}-{thread}"],
|
|
|
|
"filename": "{tim}-{filename}{ext}",
|
2015-04-08 02:26:13 +02:00
|
|
|
"pattern": [
|
2015-09-07 16:32:20 +02:00
|
|
|
r"(?:https?://)?(?:www\.)?8ch\.net/([^/]+)/res/(\d+).*",
|
2015-04-08 02:26:13 +02:00
|
|
|
],
|
|
|
|
}
|
|
|
|
|
2015-09-07 16:32:20 +02:00
|
|
|
class InfinityChanExtractor(ChanExtractor):
|
2014-10-12 21:56:44 +02:00
|
|
|
|
2015-09-07 16:32:20 +02:00
|
|
|
api_url = "https://8ch.net/{board}/res/{thread}.json"
|
2015-11-05 00:18:36 +01:00
|
|
|
file_url = "https://8ch.net/{board}/src/{tim}{ext}"
|
2014-10-12 21:56:44 +02:00
|
|
|
|
2015-10-05 15:35:48 +02:00
|
|
|
def __init__(self, match):
|
2015-09-07 16:32:20 +02:00
|
|
|
ChanExtractor.__init__(
|
2015-10-05 15:35:48 +02:00
|
|
|
self, info["category"],
|
2015-09-07 16:32:20 +02:00
|
|
|
match.group(1), match.group(2)
|
|
|
|
)
|