import auth as auth import os from getpass import getpass import requests from subprocess import call import subprocess from parsers.episode import episodeParser from parsers.lesezeichen import lesezeichenParser def main(): while True: print('PYrxoer Python wrapper for proxer.me') print('1 - Login') print('2 - Lesezeichen - All') print('3 - Lesezeichen - Anime') print('4 - Lesezeichen - Manga') print('5 - Lesezeichen - dummy') print('6 - Episode test') print('99 - exit') uin = input('$>: ') if uin == '1': user = input('username: ') pw = getpass('password:' ) sess = auth.run(user,pw) if uin == '2': LesezeichenAll(sess) if uin == '3': LesezeichenSingle(sess,1) if uin == '4': LesezeichenSingle(sess,2) if uin == '5': LesezeichenD() if uin == '6': episode_test() if uin =='99': exit() def chapter_dummy(sess,ep): response = sess.get('https://proxer.me' + ep['link']) f = open('dummys/chapter.html','w') f.write(str(response.content)) f.close() def episode(sess,episode): response = sess.get('https://proxer.me'+ep['link']) content = response.content epars = episodeParser() epars.feed(str(content)) code = epars.code link = "https://s3-psc.proxer.me/files/0/"+code+"/video.mp4" print(link) print('1 - open with vlc') print('2 - download') uin = input('$>: ') if uin == '1': call(["vlc", link]) if uin == '2': call(['curl',link,'-o',ep['title']+'.mp4']) def episode_test(): f = open('dummys/episode.html','r') content = f.readlines() f.close() epars = episodeParser() epars.feed(str(content)) code = epars.code link = "https://s3-psc.proxer.me/files/0/"+code+"/video.mp4" print(link) print('1 - open with vlc') print('2 - download') uin = input('$>: ') if uin == '1': os.popen('vlc '+link) #x = subprocess.run(['bash','vlc',link]) #call(["vlc", link]) if uin == '2': call(['curl',link,'-o','test.mp4']) def LesezeichenAll(sess): response = sess.get('https://proxer.me/ucp?s=reminder&utm_source=nav#top') lpars = lesezeichenParser() content = response.content lpars.feed(str(content)) watchlist = lpars.watchlist readlist = lpars.readlist print('Watchlist') for i in range (0,len(watchlist) - 1): print('w' + str(i) + ' - ' + watchlist[i]['name'] + ' - ' + str(watchlist[i]['new'])) print('Readlist') for i in range (0,len(readlist) - 1): print('r' + str(i) + ' - ' + readlist[i]['name'] + ' - ' + str(readlist[i]['new'])) uin = input('$>: ') link = "" if uin[0] == 'w': ep = watchlist[int(uin.replace('w',''))] episode(sess,ep) else: ep = readlist[int(uin.replace('r',''))] chapter_dummy(sess,ep) print(link) def LesezeichenSingle(sess,mode): response = sess.get('https://proxer.me/ucp?s=reminder&utm_source=nav#top') lpars = lesezeichenParser() content = response.content lpars.feed(str(content)) watchlist = lpars.watchlist readlist = lpars.readlist if mode == 1: print('Watchlist') plist = watchlist else: print('Readlist') plist = readlist for i in range (0,len(plist) - 1): print(str(i) + ' - ' + plist[i]['name'] + ' - ' + str(plist[i]['new'])) uin = input('$>: ') link = plist[int(uin)]['link'] url = 'https://proxer.me'+link print(link) print(url) f = open('episode.html','w') response = sess.get(url) f.write(str(response.content)) f.close print('written') def LesezeichenD(): lpars = lesezeichenParser() f = open('dump.html','r') content = f.readlines() lpars.feed(str(content)) watchlist = lpars.watchlist readlist = lpars.readlist print('----------------------------') print('watchlist') for i in range (0,len(watchlist) - 1): print('w' + str(i) + ' - ' + watchlist[i]['name'] + ' - ' + str(watchlist[i]['new'])) print('readlist') for i in range (0,len(readlist) - 1): print('r' + str(i) + ' - ' + readlist[i]['name'] + ' - ' + str(readlist[i]['new'])) print(str(readlist)) uin = input('$>: ') link = '' if uin[0] == 'w': link = watchlist[int(uin.replace('w',''))]['link'] else: link = readlist[int(uin.replace('r',''))]['link'] print(link) main()