2015-04-14 15:04:07 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
# Copyright 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.
|
|
|
|
|
2016-09-12 10:20:57 +02:00
|
|
|
"""Extract images and videos from https://www.4chan.org/"""
|
2015-04-14 15:04:07 +02:00
|
|
|
|
2015-06-29 23:14:35 +02:00
|
|
|
from .chan import ChanExtractor
|
2015-04-14 15:04:07 +02:00
|
|
|
|
2016-09-12 10:20:57 +02:00
|
|
|
class FourchanThreadExtractor(ChanExtractor):
|
|
|
|
"""Extractor for images from threads from 4chan.org"""
|
2015-11-21 03:13:06 +01:00
|
|
|
category = "4chan"
|
2016-09-12 10:20:57 +02:00
|
|
|
subcategory = "thread"
|
2015-11-21 03:13:06 +01:00
|
|
|
pattern = [r"(?:https?://)?boards\.4chan\.org/([^/]+)/thread/(\d+)"]
|
2016-09-19 16:15:27 +02:00
|
|
|
test = [("https://boards.4chan.org/tg/thread/15396072/", {
|
|
|
|
"url": "39082ad166161966d7ba8e37f2173a824eb540f0",
|
2016-09-25 17:28:46 +02:00
|
|
|
"keyword": "38679a7c8054f535cba67cae13eef1ea7dbc8085",
|
2016-09-19 16:15:27 +02:00
|
|
|
"content": "3081ed85a5afaeb3f430f42540e7bb5eec1908cc",
|
|
|
|
})]
|
2015-06-29 23:14:35 +02:00
|
|
|
api_url = "https://a.4cdn.org/{board}/thread/{thread}.json"
|
|
|
|
file_url = "https://i.4cdn.org/{board}/{tim}{ext}"
|
2015-04-14 15:04:07 +02:00
|
|
|
|
2015-10-05 15:35:48 +02:00
|
|
|
def __init__(self, match):
|
2015-06-29 23:14:35 +02:00
|
|
|
ChanExtractor.__init__(
|
2015-11-21 03:13:06 +01:00
|
|
|
self, match.group(1), match.group(2)
|
2015-06-29 23:14:35 +02:00
|
|
|
)
|