-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmake_title.py
34 lines (32 loc) · 1.27 KB
/
make_title.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import io
import jaconv
import requests
from bs4 import BeautifulSoup
def make(start, unknown, okazu):
basetext = "SELECT g.furigana,g.gamename,b.brandname,g.sellday FROM gamelist g INNER JOIN brandlist b ON b.id = g.brandname WHERE "
basetext += "sellday >= '{}' ".format(start)
if unknown == False:
basetext += "AND sellday <> '2030-01-01' "
if okazu == False:
basetext += "AND okazu <> 't' "
basetext += "ORDER BY g.furigana"
url = "http://erogamescape.dyndns.org/~ap2/ero/toukei_kaiseki/sql_for_erogamer_form.php"
s = requests.session()
payload = {'sql': basetext}
r = s.post(url, data=payload)
html = r.text
soup = BeautifulSoup(html, 'html.parser')
table = soup.find('table')
text = ""
for i,row in enumerate(table.find_all('tr')):
if i == 0:
continue
data = row.find_all('td')
text += "{furigana}\t{title}\t固有名詞\tブランド名:{brand}|発売日:{sellday}\n"\
.format(furigana=jaconv.kata2hira(data[0].string), title=data[1].string,\
brand=data[2].string, sellday=data[3].string)
return text
if __name__ == "__main__":
out = open('ergtitle.txt','wt',encoding='UTF-8')
out.write(make("1995-01-01", False, False))
out.close()