<commit_before># -*- coding: utf-8 -*-
#
# ドラクエ10の冒険者の広場画像の一括ダウンロード
#

import os
import re
import sys
import cookielib
import mechanize
from bs4 import BeautifulSoup as bs

def do_login(b, us, pw, ci):
    # ログイン画面
    r = b.open('http://hiroba.dqx.jp/sc/login')
    print(b.geturl())
    print(b.title())
    b.select_form(name='mainForm')
    for f in b.form.controls:
        f.readonly = False
    b.form['_pr_confData_sqexid'] = us
    b.form['_pr_confData_passwd'] = pw
    b.form['_pr_confData_otppw'] = ''
    b.form['_event'] = 'Submit'
    b.submit()
    # 中間画面
    print(b.geturl())
    print(b.title())
    b.select_form(name='mainForm')
    b.submit()
    # キャラクターセレクト
    r = b.open('http://hiroba.dqx.jp/sc/login/characterselect/')
    print(b.geturl())
    print(b.title())
    b.select_form(nr=0)
    for f in b.form.controls:
        f.readonly = False
    b.form['cid'] = ci
    b.submit()

def test_login(b):
    r = b.open('http://hiroba.dqx.jp/sc/home')
    s = bs(r)
    p = s.find_all('h1', {'id': 'cttTitle'})
    if len(p) == 0:
        raise Exception()

def get_browser(filename, proxy=None):
    # username, character_id, directory
    f = open(filename, 'r')
    us = f.readline().strip()
    ci = f.readline().strip()
    dr = f.readline().strip()
    f.close()
    # ask for password
    pw = raw_input('Password? ')
    # setup browser
    b = mechanize.Browser()<commit_msg>use getpass<commit_after># -*- coding: utf-8 -*-
#
# ドラクエ10の冒険者の広場画像の一括ダウンロード
#

import getpass
import os
import re
import sys
import cookielib
import mechanize
from bs4 import BeautifulSoup as bs

def do_login(b, us, pw, ci):
    # ログイン画面
    r = b.open('http://hiroba.dqx.jp/sc/login')
    print(b.geturl())
    b.select_form(name='mainForm')
    for f in b.form.controls:
        f.readonly = False
    b.form['_pr_confData_sqexid'] = us
    b.form['_pr_confData_passwd'] = pw
    b.form['_pr_confData_otppw'] = ''
    b.form['_event'] = 'Submit'
    b.submit()
    # 中間画面
    print(b.geturl())
    b.select_form(name='mainForm')
    b.submit()
    # キャラクターセレクト
    r = b.open('http://hiroba.dqx.jp/sc/login/characterselect/')
    print(b.geturl())
    b.select_form(nr=0)
    for f in b.form.controls:
        f.readonly = False
    b.form['cid'] = ci
    b.submit()

def test_login(b):
    r = b.open('http://hiroba.dqx.jp/sc/home')
    s = bs(r)
    p = s.find_all('h1', {'id': 'cttTitle'})
    if len(p) == 0:
        raise Exception()

def get_browser(filename, proxy=None):
    # username, character_id, directory
    f = open(filename, 'r')
    us = f.readline().strip()
    ci = f.readline().strip()
    dr = f.readline().strip()
    f.close()
    # ask for password
    pw = getpass.getpass()
    # setup browser
    b = mechanize.Browser()
{'fraction_non_alphanumeric': 0.16847826086956522, 'fraction_numerical': 0.005072463768115942, 'mean_word_length': 2.741192411924119, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4062036', 'n_tokens_mistral': 1170, 'n_tokens_neox': 1135, 'n_words': 209}