1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-26 12:42:29 +01:00
gallery-dl/gallery_dl/extractor/8chan.py

33 lines
927 B
Python
Raw Normal View History

# -*- 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
info = {
"category": "8chan",
"extractor": "InfinityChanExtractor",
2015-09-07 16:32:20 +02:00
"directory": ["{category}", "{board}-{thread}"],
"filename": "{tim}-{filename}{ext}",
"pattern": [
2015-09-07 16:32:20 +02:00
r"(?:https?://)?(?:www\.)?8ch\.net/([^/]+)/res/(\d+).*",
],
}
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
def __init__(self, match):
2015-09-07 16:32:20 +02:00
ChanExtractor.__init__(
self, info["category"],
2015-09-07 16:32:20 +02:00
match.group(1), match.group(2)
)