|
|
@@ -1,6 +1,8 @@
|
|
|
import auth as auth
|
|
|
from tqdm import tqdm
|
|
|
+import pickle
|
|
|
import os
|
|
|
+import configparser
|
|
|
from getpass import getpass
|
|
|
import requests
|
|
|
from subprocess import call
|
|
|
@@ -10,21 +12,43 @@ from parsers.lesezeichen import lesezeichenParser
|
|
|
from parsers.chapter import chapterParser
|
|
|
from parsers.player import playerParser
|
|
|
|
|
|
+if os.path.isfile('cookies'):
|
|
|
+ f = open('cookies','rb')
|
|
|
+ sess = requests.session()
|
|
|
+ sess.cookies.update(pickle.load(f))
|
|
|
+
|
|
|
def main():
|
|
|
+ ReadConfig()
|
|
|
+ print(config['paths']['anime_path'])
|
|
|
while True:
|
|
|
print('PYrxoer Python wrapper for proxer.me')
|
|
|
+ print('0 - Load')
|
|
|
print('1 - Login')
|
|
|
print('2 - Lesezeichen - All')
|
|
|
print('3 - Lesezeichen - Anime')
|
|
|
print('4 - Lesezeichen - Manga')
|
|
|
+ print('5 - Browse local')
|
|
|
print('99 - exit')
|
|
|
|
|
|
uin = input('$>: ')
|
|
|
+
|
|
|
+ # auth.checkLogin()
|
|
|
+
|
|
|
+ if uin == '0':
|
|
|
+ if os.path.isfile(config['paths']['cookie_jar']):
|
|
|
+ f = open(config['paths']['cookie_jar'],'rb')
|
|
|
+ sess = requests.session()
|
|
|
+ sess.cookies.update(pickle.load(f))
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
if uin == '1':
|
|
|
user = input('username: ')
|
|
|
pw = getpass('password:' )
|
|
|
- sess = auth.run(user,pw)
|
|
|
+ sess = auth.login(user,pw)
|
|
|
print(str(auth.token))
|
|
|
+ f = open(config['paths']['cookie_jar'],'wb')
|
|
|
+ pickle.dump(sess.cookies,f)
|
|
|
|
|
|
if uin == '2':
|
|
|
LesezeichenAll(sess)
|
|
|
@@ -45,7 +69,7 @@ def chapter(sess,ep):
|
|
|
chapPars = chapterParser()
|
|
|
chapPars.images = []
|
|
|
chapPars.feed(str(content))
|
|
|
- path = 'manga/'+ep['name']+'/'+ep['num']+'/'
|
|
|
+ path = config['paths']['manga_path']+'/'+ep['name']+'/'+ep['num']+'/'
|
|
|
if not os.path.exists(path):
|
|
|
os.makedirs(path)
|
|
|
print(str(ep))
|
|
|
@@ -103,11 +127,11 @@ def chapter(sess,ep):
|
|
|
def episode(sess,ep):
|
|
|
response = sess.get('https://proxer.me'+ep['link'])
|
|
|
content = response.content
|
|
|
- print(str(content))
|
|
|
epars = episodeParser()
|
|
|
epars.feed(str(content))
|
|
|
code = epars.code
|
|
|
- link = 'https:'+epars.url.replace('#',code)
|
|
|
+ #link = 'https:'+epars.url.replace('#',code)
|
|
|
+ link = epars.url.replace('#',code)
|
|
|
response = sess.get(link)
|
|
|
ppars = playerParser()
|
|
|
ppars.feed(str(response.content))
|
|
|
@@ -120,6 +144,7 @@ def episode(sess,ep):
|
|
|
print('4 - go to next')
|
|
|
print('5 - go to previous')
|
|
|
print('6 - Details')
|
|
|
+ print('99 - Exit')
|
|
|
path = 'anime/'+ep['name']+'/'
|
|
|
if not os.path.exists(path):
|
|
|
os.makedirs(path)
|
|
|
@@ -132,6 +157,18 @@ def episode(sess,ep):
|
|
|
url = 'https://proxer.me' + ep['link'].replace('#top','?format=json&type=reminder&'+ epars.token +'=1&title=reminder_next')
|
|
|
response = sess.post(url,data = {"check":1})
|
|
|
print(str(response.content))
|
|
|
+
|
|
|
+ if uin =='4':
|
|
|
+ prev = ep
|
|
|
+ linkParts = ep['link'].split('/')
|
|
|
+ linkParts[3] = str(int(linkParts[3]) +1)
|
|
|
+ prev['link'] = '/'.join(linkParts)
|
|
|
+ prev['num'] = str(int(prev['num'])+1)
|
|
|
+ episode(sess,prev)
|
|
|
+
|
|
|
+ if uin == '99':
|
|
|
+ break
|
|
|
+
|
|
|
|
|
|
def LesezeichenAll(sess):
|
|
|
watchlist = []
|
|
|
@@ -186,5 +223,15 @@ def LesezeichenSingle(sess,mode):
|
|
|
f.write(str(response.content))
|
|
|
f.close
|
|
|
print('written')
|
|
|
+
|
|
|
+def ReadConfig():
|
|
|
+ global config
|
|
|
+ config = configparser.ConfigParser()
|
|
|
+ config.read_file(open('settings.cfg'))
|
|
|
+
|
|
|
+def ListLocal():
|
|
|
+ anime = []
|
|
|
+ manga = []
|
|
|
+
|
|
|
|
|
|
main()
|