-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
26 lines (23 loc) · 792 Bytes
/
main.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
from const import *
from src.services.EhFavoriteService import EhFavoriteService
from src.headers.EhHeadersBuilder import EhHeadersBuilder
from src.services.MetadataService import MetadataService
from src.services.TsvService import TsvService
d = {
'a': "Download favorite list",
'b_input': "Find link with title",
'input': ''
}
arg = input("\n".join([key + "> " + d[key] for key in d]))
if arg == 'a':
headers = EhHeadersBuilder().build()
service = EhFavoriteService(headers)
service.scrapy()
storage = TsvService()
storage.save(service.get_list())
elif arg == 'b_input':
service = MetadataService(TsvService())
for line in open(TITLES_FILE_NAME, 'r', encoding='utf-8'):
title = line.strip()
service.find_link(title)
print("Done!")