Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- '''DMMのURIからページを取得し素人系総合wiki用ウィキテキストを作成する
- 書式:
- dmm2ssw.py DMM作品ページのURI [オプション...]
- 説明:
- オプションで与えられない情報は可能な限りDMMのページから取得してウィキテキスト
- を作成し標準出力へ出力する。
- タイトルに「(ハート)」と「◆」があった場合は「♥」に置き換える。
- その他wiki構文上問題のある文字列があれば置き換える。
- 置き換えた場合、元のDMM上のタイトルはコメントとして残す(検索用)。
- ただし -d オプションが与えられるとこれらの変更は行わない。
- 女優名に過去の芸名が付記されている場合(「現在の芸名 (旧芸名...)」)は旧芸名を
- 除去する。
- ただし -o オプションが与えられると除去しない。
- 女優ページ用の他、シリーズ一覧ページ用に表(table)形式のウィキテキストも作成
- できる。
- DVD通販、DVDレンタル、動画-ビデオ/-素人、および月額動画のページには対応して
- いるはず。
- オプション:
- -a, --actress 出演者 [出演者 ...]
- クレジットされてない出演者を追加する場合用。
- 出演者(のwikiページ名)を指定する。
- DMMページ上にすでに出演者情報が存在する場合はその末尾に追加される。
- -n 指定も含め2名に満たない場合は出力されない。
- -n, --number 出演者数
- 未知の出演者がいる場合用。
- 出演者の総数を指定する。
- 指定されると出演者の最後に「… ほか計n名」を追加する。
- 既知の出演者数以下の場合は無視される。
- -s, --series シリーズ一覧ページ名
- DMM上でのシリーズとwikiでのシリーズの扱いが異なる場合用。
- wiki上で作品が記載されているシリーズ(メーカー、レーベル)一覧ページの名前を
- 指定する。
- 指定されるとDMMページ上のものを置き換える。
- -t, --table
- シリーズページ用の表(table)形式のウィキテキストのみ出力する。
- -tt と同時に指定できない。
- -tt, --with-table
- シリーズページ用の表(table)形式のウィキテキストも出力する。
- -t と同時に指定できない。
- --pid 品番
- -t/-tt オプションが与えられた時用。
- 作品の品番を直接指定する。
- ※指定しない場合
- DMM上の品番情報(cid=)から自動生成を試みる。
- 正規表現にマッチした場合置き換えられ、すべて大文字化される。
- マッチしても正しい品番にならない場合があるので注意。
- マッチしなかったら変更せずそのまま出力する。
- 自動生成パターン(python正規表現)と置換文字列:
- '^(?:h_|)\d*([a-z]+)(\d+r?).*', '\1-\2'
- (cid=)1hunt569 ⇒ HUNT-569
- (cid=)41hrdv01212r ⇒ HRDV-01212R
- (cid=)h_093crc035 ⇒ CRC-035
- ※正しく生成できない例
- (cid=)h_093r18243 ⇒ ×R-18243 (○R18-243)
- (cid=)125ud537ra ⇒ ×UD-537R (○UD537R)
- --subtitle 副題
- -t/-tt オプションが与えられた時用。
- 作品名の副題(SUBTITLEカラムに出力される)に指定された副題を出力する。
- --note 備考
- 通常形式ではウィキテキストの最後、表形式では右端の「NOTE」カラムに指定された
- 文字列を出力する。
- --extra 文字列 [文字列 ...]
- 通常形式では備考の上に、表形式では「NOTE」の左に任意のカラムを追加し、そこに
- 文字列を出力する。
- --follow-redirect
- 指定・取得した出演者名のページがリダイレクトページだった場合にリダイレクト先
- のリンクを付加する。
- 出演者が複数いた場合のwikiへの問い合わせ間隔は3秒。
- -m, --disable-modify-title
- タイトルの自動修正を無効にする(「説明」参照)。
- -o, --disable-strip-oldname
- 出演者の旧名の自動除去を無効にする(「説明」参照)。
- -c, --clear-cache
- httplib2使用時に作成されるHTTPキャッシュを終了時に削除する(「注意」参照)。
- httplib2を使用していない場合は無視される。
- -v, --verbose
- デバッグ用情報を出力する。
- -V, --version
- バージョン情報を表示して終了する。
- -h, --help
- ヘルプメッセージを表示して終了する。
- 動作条件:
- [必須] python3
- - python2では動作しない。
- [推奨] httplib2 (python3用)
- - なければ標準ライブラリを使用するが、その場合ページ取得時サーバにかかる負荷
- が比較して大きくなる。頻繁に使うならhttplib2の使用を強く推奨。
- そして標準ライブラリではあまりテストしていない。
- 注意:
- ページによってはデータの取得に失敗するかもしれない(HTMLの整形が異なっていたり
- ブラウザは許容できてもHTMLParserはできない構文ミスがあったりすることがある)。
- このスクリプトを連続実行させて短時間に大量の情報を取得した場合、その間隔が
- 短いと(D)DoS攻撃とみなされて通報されるかもしれないので注意。
- httplib2を使用している場合、OSのテンポラリディレクトリ (C:\TEMP や /tmp
- など) にディレクトリ 'dmm2ssw_cache' を作成し、そこにHTTPレスポンスや
- コンテンツをキャッシュする。
- キャッシュを自分でクリアしたい場合はディレクトリごと直接消すか -c オプション
- を指定する。
- 更新履歴:
- 20120901 https://pastebin.com/Vds3M5Rn
- 20120901.1 https://pastebin.com/X5urzKrA
- 20180123.0 文字コード判定変換追加
- '''
- __version__ = 20180123.0
- import os
- import sys
- import re
- import argparse
- import time
- import urllib.parse
- from tempfile import gettempdir
- from shutil import rmtree
- from html.parser import HTMLParser
- HTTPLIB2 = True
- try:
- # httplib2があれば使う
- import httplib2
- except ImportError:
- # なければurllib.requestを使う (非推奨)
- import urllib.request, urllib.error
- HTTPLIB2 = False
- OWNNAME = os.path.splitext(os.path.basename(__file__))[0]
- CACHEDIR = gettempdir() + '/dmm2ssw_cache'
- VERBOSE = 0
- MSGLEVEL = {'E': 'ERROR',
- 'W': 'WARNING',
- 'I': 'INFO'}
- p_cid = re.compile(r'/cid=(.+)/')
- p_acts = re.compile(r'/article=actress/')
- p_dir = re.compile(r'/article=director/')
- p_series = re.compile(r'/article=series/')
- p_maker = re.compile(r'/article=maker/')
- p_label = re.compile(r'/article=label/')
- p_rdate = re.compile(r'\d{4}/\d{2}/\d{2}')
- sp_tsuffix = (re.compile(r' - \S*( - DMM.R18|)$'), '')
- sp_oldname = (re.compile(r'[((].*$'), '')
- sp_heart = (re.compile(r'(ハート)|◆'), r'♥')
- sp_bracket = (re.compile(r'\[(.*)\]'), r'[\1]')
- sp_pid = (re.compile(r'^(?:h_|)\d*([a-z]+)(\d+r?).*', re.I), r'\1-\2')
- sp_wikis = (re.compile(r'href=(/.*/)>'), r'href="\1">')
- SUMMARY = {}
- AUTOMODIFY = True
- AUTOSTRIP = True
- def verbose(msg):
- '''デバッグ用情報の出力'''
- if VERBOSE:
- print('({0}): >>> {1}'.format(OWNNAME, msg), file=sys.stderr)
- sys.stderr.flush()
- def stderror(level, msg):
- '''標準エラー出力へメッセージ出力'''
- print('({0}): {1} ** {2}'.format(OWNNAME, MSGLEVEL[level], msg),
- file=sys.stderr)
- sys.stderr.flush()
- if level == 'E':
- # エラーなら終了
- raise SystemExit('({0}): ** プログラムを終了します。'.format(OWNNAME))
- def uri_openerror(name, info):
- '''URIオープン時のエラーメッセージ'''
- stderror('E', 'URIを開く時にエラーが発生しました ({0})。詳細: {1}'.format(name, info))
- def sub(p_list, string, n=False):
- '''re.sub()、re.subn()ラッパー'''
- return p_list[0].subn(p_list[1], string) if n \
- else p_list[0].sub(p_list[1], string)
- def get_args():
- '''コマンドライン引数の解釈'''
- global VERBOSE
- parser = argparse.ArgumentParser(
- description='DMMのURIから素人系総合wiki用ウィキテキストを作成する')
- parser.add_argument('uri',
- help='DMMの作品ページのURI',
- metavar='URI',)
- parser.add_argument('-a', '--actress',
- help='出演者 (DMMページ内のものに追加する)',
- nargs='+',
- default=())
- parser.add_argument('-n', '--number',
- help='未知の出演者がいる場合の総出演者数 (… ほか計NUMBER名)',
- type=int,
- default=0)
- parser.add_argument('-s', '--series',
- help='シリーズ名 (DMMページ内のものを置き換える)')
- table = parser.add_mutually_exclusive_group()
- table.add_argument('-t', '--table',
- help='シリーズページ用の表形式ウィキテキストのみ作成する',
- action='store_const',
- dest='table',
- const=2,
- default=0)
- table.add_argument('-tt', '--with-table',
- help='シリーズページ用の表形式ウィキテキストも作成する',
- action='store_const',
- dest='table',
- const=1,
- default=0)
- parser.add_argument('--pid',
- help='作品の品番 (-t/-tt 指定時用)',
- default='')
- parser.add_argument('--subtitle',
- help='タイトルの副題 (-t/-tt 指定時用)',
- default='')
- parser.add_argument('--note',
- help='備考として出力する文字列',
- default='')
- parser.add_argument('--extra',
- help='備考以外に任意のカラムと文字列を追加する',
- metavar='STRING',
- nargs='*',
- default=())
- parser.add_argument('--follow-redirect',
- help='出演者名ページのリダイレクト先を取得する',
- action='store_true')
- parser.add_argument('-m', '--disable-modify-title',
- help='タイトルの自動調整を無効にする',
- action='store_false')
- parser.add_argument('-o', '--disable-strip-oldname',
- help='出演者の旧芸名の自動除去を無効にする',
- action='store_false')
- parser.add_argument('-c', '--clear-cache',
- help='プログラム終了時にHTTPキャッシュをクリアする',
- action='store_true')
- parser.add_argument('-v', '--verbose',
- help='デバッグ用情報を出力する',
- action='append_const',
- const=1,
- default=[])
- parser.add_argument('-V', '--version',
- help='バージョン情報を表示して終了する',
- action='version',
- version='%(prog)s {}'.format(__version__))
- args = parser.parse_args()
- VERBOSE = VERBOSE or args.verbose.count(1)
- if VERBOSE:
- verbose('Verbose mode on')
- verbose('args: {}'.format(args))
- return args
- def open_uri(uri):
- '''URIを開いて読み込む'''
- if HTTPLIB2:
- verbose('Use httplib2')
- if VERBOSE > 1: httplib2.debuglevel = 1
- h = httplib2.Http(CACHEDIR)
- verbose('cachedir: ' + CACHEDIR)
- try:
- resp, rawhtml = h.request(uri)
- except (httplib2.RelativeURIError,
- httplib2.ServerNotFoundError) as e:
- uri_openerror(e.__class__.__name__, ", ".join(e.args))
- else:
- verbose('Use urllib')
- if VERBOSE > 1:
- from http.client import HTTPConnection
- HTTPConnection.debuglevel = 1
- try:
- rawhtml = urllib.request.urlopen(uri).read()
- #return urllib.request.build_opener().open(SUMMARY['uri'])
- except urllib.error.HTTPError as e:
- uri_openerror(e.__class__.__name__, '{0} {1}'.format(e.code, e.msg))
- except urllib.error.URLError as e:
- uri_openerror(e.__class__.__name__, e.reason)
- except ValueError as e:
- uri_openerror(e.__class__.__name__, ", ".join(e.args))
- # 文字コード判定変換(古いページはEUC-JP、最近のものはUTF-8)
- temphtml = rawhtml.decode()
- if temphtml.find('<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />') != -1:
- return temphtml
- return rawhtml.decode('euc-jp', 'ignore')
- def retrieve_title(title):
- '''タイトルの採取と調整'''
- verbose('title_tag: "{}"'.format(title))
- # タイトルの後に付く文字列の除去
- on_dmm = modified = sub(sp_tsuffix, title)
- if AUTOMODIFY:
- # ♥の代替文字列の置き換え
- modified = sub(sp_heart, modified)
- # wiki構文と衝突する文字列の置き換え
- modified = sub(sp_bracket, modified)
- if on_dmm != modified:
- SUMMARY['title'] = modified
- SUMMARY['title_dmm'] = on_dmm
- else:
- SUMMARY['title'] = on_dmm
- verbose('title: "{}"'.format(SUMMARY['title']))
- verbose('title_dmm: "{}"'.format(SUMMARY['title_dmm']))
- class DMMParser(HTMLParser):
- '''HTMLの解析'''
- def __init__(self):
- HTMLParser.__init__(self)
- self.content = ''
- self.block = ''
- self.img_lg = ''
- self.img_p = ''
- self.alist = []
- self.dlist = []
- self.blabel = {'出演者:': ('actress', p_acts),
- '監督:': ('director', p_dir),
- 'シリーズ:': ('series', p_series),
- 'メーカー:': ('maker', p_maker),
- 'レーベル:': ('label', p_label)}
- def handle_starttag(self, tag, attrs):
- global SUMMARY
- attr_dict = dict(attrs)
- if tag == 'title':
- # タイトルの検出
- self.content = 'title'
- verbose('title tag found')
- elif tag == 'meta' and attr_dict.get('property') == 'og:image':
- # 画像(小)のURIの採取
- SUMMARY['image_sm'] = attr_dict['content']
- verbose('image sm: ' + attr_dict['content'])
- elif tag == 'div' and attr_dict.get('id') == 'sample-video':
- # 画像のあるブロックの開始
- self.block = 'image'
- elif self.block == 'image' and tag == 'img' and 'src' in attr_dict:
- # フォールバック用画像
- self.img_p = attr_dict['src']
- verbose('image c p : ' + self.img_p)
- elif self.block == 'image' \
- and tag == 'a' and attr_dict.get('name') == 'package-image':
- # 画像(大)のURIの採取
- self.img_lg = attr_dict['href']
- verbose('image c lg: ' + self.img_lg)
- elif self.block in self.blabel and tag == 'a' and 'href' in attr_dict:
- # 出演者、監督、シリーズ、またはメーカーのリンクの検出
- href = attr_dict['href']
- if self.blabel[self.block][1].search(href):
- self.content = self.blabel[self.block][0]
- verbose('{} link found'.format(self.content))
- def handle_endtag(self, tag):
- if self.block == 'image' and tag == 'div':
- # 画像(大)の決定
- SUMMARY['image_lg'] = self.img_lg or self.img_p
- verbose('image lg: ' + SUMMARY['image_lg'])
- self.block = self.img_lg = self.img_p = ''
- elif self.block in ('出演者:', '監督:') and tag == 'tr':
- # 出演者または監督ブロックの終了
- verbose('block {} end'.format(self.block))
- verbose('{}: {}'.format(self.blabel[self.block][0],
- SUMMARY[self.blabel[self.block][0]]))
- self.block = ''
- def handle_data(self, data):
- global SUMMARY
- data = data.strip()
- if self.content == 'title':
- # タイトルの採取および調整
- retrieve_title(data)
- elif data in ('発売日:', '貸出開始日:', '配信開始日:'):
- # 発売日情報ブロックの開始をマーク
- self.block = 'release'
- verbose('relase date marked')
- elif self.block == 'release' and p_rdate.match(data):
- # 発売日の採取
- rdate = data.replace('/', '.')
- SUMMARY['release'] = rdate
- verbose('release: ' + rdate)
- self.block = ''
- elif data in self.blabel:
- # 出演者、監督、シリーズ、メーカー、およびレーベルブロックの開始をマーク
- self.block = data
- verbose('block {} marked'.format(data))
- # 出演者、監督、シリーズ、メーカー、およびレーベルの実際の文字列の取得
- elif self.content == 'actress':
- verbose('actress_orig: ' + data)
- if AUTOSTRIP:
- data = sub(sp_oldname, data)
- SUMMARY[self.content].append(data)
- elif self.content == 'director':
- verbose('director_orig: ' + data)
- SUMMARY[self.content].append(data)
- elif self.content in ('series', 'maker', 'label'):
- SUMMARY[self.content] = data
- verbose(self.content + ': ' + data)
- self.block = ''
- self.content = ''
- class SswRedirectDest(HTMLParser):
- '''wikiリダイレクトの検出'''
- def __init__(self):
- HTMLParser.__init__(self)
- self.flg_div = False
- self.flg_redir = False
- self.flg_dest = False
- self.dest = ''
- def handle_starttag(self, tag, attrs):
- if not self.flg_div \
- and tag == 'div' and attrs == [('class', 'user-area')]:
- self.flg_div = True
- verbose('ssw.div found')
- elif self.flg_div and self.flg_redir and tag == 'a':
- self.flg_dest = True
- verbose('ssw.dest found')
- def handle_data(self, data):
- data = data.strip()
- if self.flg_div and data == 'リダイレクト:':
- self.flg_redir = True
- verbose('ssw.redir found')
- elif self.flg_dest:
- self.dest = data
- verbose('dest: {}'.format(data))
- def handle_endtag(self, tag):
- if self.flg_dest and tag == 'a':
- self.flg_div = self.flg_redir = self.flg_dest = False
- def follow_redirect(actress, parser):
- alist = []
- while actress:
- a = actress.pop(0)
- verbose('ssw.a: {}'.format(a))
- ssw_uri = 'http://sougouwiki.com/d/{}'.format(
- urllib.parse.quote(a.encode('euc-jp'), 'euc-jp'))
- verbose('ssw uri: {}'.format(ssw_uri))
- html = open_uri(ssw_uri)
- parser.__init__()
- parser.feed(html)
- a = '{}>{}'.format(a, parser.dest) if parser.dest else a
- verbose('redirect: {}'.format(a))
- alist.append(a)
- if actress: time.sleep(3)
- return(alist)
- def check_missings():
- '''未取得情報のチェック'''
- missings = [m for m in ('release', 'title', 'maker', 'label', 'image_sm') if not SUMMARY[m]]
- verbose('missings: {}'.format(missings))
- if missings:
- stderror('W', '取得できない情報がありました: {0}'.format(",".join(missings)))
- def format_wikitext_r(anum, astr):
- '''ウィキテキストの作成 女優ページ用'''
- wtextlist = []
- # 発売日
- wtextlist.append('//{0[release]}'.format(SUMMARY))
- # 自動修正があった場合のDMM上のタイトル (コメント)
- if SUMMARY['title_dmm']:
- wtextlist.append('//{0[title_dmm]} #検索用'.format(SUMMARY))
- # タイトルおよびメーカー
- titleline = '[[{0[title]}({1})>{0[uri]}]]'.format(
- SUMMARY, SUMMARY['maker'] or SUMMARY['label'])
- # シリーズ
- if SUMMARY['series']:
- titleline += ' [[(シリーズ一覧)>{0[series]}]]'.format(SUMMARY)
- wtextlist.append(titleline)
- # 画像
- if SUMMARY['image_sm'] == SUMMARY['image_lg']:
- wtextlist.append('{0[image_sm]}'.format(SUMMARY))
- else:
- wtextlist.append('[[{0[image_sm]}>{0[image_lg]}]]'.format(SUMMARY))
- # 出演者
- if anum > 1:
- wtextlist.append('出演者:{0}'.format(astr))
- # 追加カラム
- if SUMMARY['extra']:
- wtextlist.extend(SUMMARY['extra'])
- # 備考
- if SUMMARY['note']:
- wtextlist.append(SUMMARY['note'])
- wtextlist.append('')
- return wtextlist
- def format_wikitext_t(astr, dstr):
- '''ウィキテキストの作成 table形式'''
- wtext = ''
- # 品番
- wtext += '|[[{0[pid]}>{0[uri]}]]'.format(SUMMARY)
- # 画像
- if SUMMARY['image_sm'] == SUMMARY['image_lg']:
- wtext += '|{0[image_sm]}'.format(SUMMARY)
- else:
- wtext += '|[[{0[image_sm]}>{0[image_lg]}]]'.format(SUMMARY)
- # サブタイトル
- wtext += '|{0[subtitle]}'.format(SUMMARY)
- # 出演者
- wtext += '|{0}'.format(astr)
- # 監督
- wtext += '|{0}'.format(dstr)
- # 発売日
- wtext += '|{0[release]}'.format(SUMMARY).replace('.', '-')
- # 追加カラム
- if SUMMARY['extra']:
- wtext += '|{}'.format('|'.join(SUMMARY['extra']))
- # 備考
- wtext += '|{0[note]}|'.format(SUMMARY)
- return wtext
- def main(param_tbl=0, param_subtitle='', param_series='', param_redir=False,
- param_uri='', param_pid='', param_actress=(), param_num=0,
- param_note='', param_extra=()):
- '''主処理'''
- global VERBOSE
- global SUMMARY
- global AUTOMODIFY
- global AUTOSTRIP
- SUMMARY = {'uri': '',
- 'release': '',
- 'title': '',
- 'title_dmm': '',
- 'subtitle': '',
- 'actress': [],
- 'director': [],
- 'series': '',
- 'maker': '',
- 'label': '',
- 'pid': '',
- 'image_sm': '',
- 'image_lg': '',
- 'number': 0,
- 'note': '',
- 'extra': []}
- tablefmt = 0 # 1: table形式も作成, 2: table形式のみ作成
- wikitext_r = []
- wikitext_t = ''
- if __name__ != '__main__':
- # モジュール呼び出しの場合継承したコマンドライン引数は無視
- sys.argv = [sys.argv[0], param_uri]
- # コマンドライン引数の解釈
- args = get_args()
- SUMMARY['uri'] = param_uri or args.uri
- SUMMARY['number'] = param_num or args.number
- SUMMARY['note'] = param_note or args.note
- SUMMARY['extra'] = param_extra or args.extra
- add_actress = param_actress or args.actress
- tablefmt = param_tbl or args.table
- follow_redir = param_redir or args.follow_redirect
- AUTOMODIFY = args.disable_modify_title
- AUTOSTRIP = args.disable_strip_oldname
- # URIを開いて読み込む
- html = open_uri(SUMMARY['uri'])
- # HTMLParserが解析できない構文ミスの修正
- html = sub(sp_wikis, html)
- # HTMLの解析
- parser = DMMParser()
- parser.feed(html)
- verbose('SUMMARY: {}'.format(SUMMARY))
- SUMMARY['series'] = param_series or args.series or SUMMARY['series']
- # 品番の設定
- SUMMARY['pid'] = param_pid or args.pid
- if not SUMMARY['pid']:
- # 未指定時の自動生成 (汎用)
- pid, m = sub(sp_pid, p_cid.search(SUMMARY['uri']).group(1), True)
- if m: SUMMARY['pid'] = pid.upper()
- verbose('pid: ' + SUMMARY['pid'])
- # 既知の全出演者リストの作成
- SUMMARY['actress'].extend(
- filter(lambda a: not a in SUMMARY['actress'], add_actress))
- if follow_redir:
- follower = SswRedirectDest()
- SUMMARY['actress'] = follow_redirect(SUMMARY['actress'], follower)
- verbose('actress: {}'.format(SUMMARY['actress']))
- # 出演者文字列の作成
- actsstr = "/".join('[[{0}]]'.format(p) for p in SUMMARY['actress'])
- anum = len(SUMMARY['actress'])
- if SUMMARY['number'] > anum:
- actsstr += ' ほか計{0}名'.format(SUMMARY['number'])
- anum = SUMMARY['number']
- # 監督文字列の作成
- dirstr = "/".join(SUMMARY['director'])
- # table形式用副題の生成
- SUMMARY['subtitle'] = param_subtitle or args.subtitle
- if not SUMMARY['subtitle']:
- SUMMARY['subtitle'] = \
- re.sub(SUMMARY['series'], '', SUMMARY['title']).strip() \
- if SUMMARY['series'] else SUMMARY['title']
- verbose('subtitle: {}'.format(SUMMARY['subtitle']))
- # 未取得情報のチェック
- if VERBOSE: check_missings()
- # ウィキテキストの作成
- if tablefmt < 2:
- wikitext_r = format_wikitext_r(anum, actsstr)
- verbose('wikitext_r: {}'.format(wikitext_r))
- if tablefmt:
- wikitext_t = format_wikitext_t(actsstr, dirstr)
- verbose('wikitext_t: {}'.format(wikitext_t))
- if __name__ != '__main__':
- # モジュール呼び出しならタプルを返す。
- return (SUMMARY['release'], SUMMARY['pid'], wikitext_r, wikitext_t)
- else:
- # 書き出す
- print()
- for t in wikitext_r + [wikitext_t]:
- print(t)
- # キャッシュディレクトリの削除
- if HTTPLIB2 and args.clear_cache: rmtree(CACHEDIR)
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement