Phil пре 6 година
родитељ
комит
3aae27ec6f
1 измењених фајлова са 32 додато и 7 уклоњено
  1. 32 7
      main.py

+ 32 - 7
main.py

@@ -1,9 +1,11 @@
 import auth as auth
 import auth as auth
+import os
 from getpass import getpass
 from getpass import getpass
 import requests
 import requests
 from html.parser import HTMLParser
 from html.parser import HTMLParser
 from html.entities import name2codepoint
 from html.entities import name2codepoint
 from subprocess import call
 from subprocess import call
+import subprocess
 
 
 def main():
 def main():
     while True:
     while True:
@@ -40,6 +42,22 @@ def main():
         if uin =='99':
         if uin =='99':
             exit()
             exit()
 
 
+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():
 def episode_test():
     f = open('episode.html','r')
     f = open('episode.html','r')
     content = f.readlines()
     content = f.readlines()
@@ -53,7 +71,9 @@ def episode_test():
     print('2 - download')
     print('2 - download')
     uin = input('$>: ')
     uin = input('$>: ')
     if uin == '1':
     if uin == '1':
-        call(["vlc", link])
+        os.popen('vlc '+link)
+        #x = subprocess.run(['bash','vlc',link])
+        #call(["vlc", link])
     if uin == '2':
     if uin == '2':
         call(['curl',link,'-o','test.mp4'])
         call(['curl',link,'-o','test.mp4'])
     
     
@@ -70,12 +90,14 @@ def LesezeichenAll(sess):
     print('Readlist')
     print('Readlist')
     for i in range (0,len(readlist) - 1):
     for i in range (0,len(readlist) - 1):
         print('r' + str(i) + ' - ' + readlist[i]['name'] + ' - ' + str(readlist[i]['new']))
         print('r' + str(i) + ' - ' + readlist[i]['name'] + ' - ' + str(readlist[i]['new']))
-    print(str(readlist))
     uin = input('$>: ')
     uin = input('$>: ')
+    link = ""
     if uin[0] == 'w':
     if uin[0] == 'w':
-        print(watchlist[int(uin.replace('w',''))]['link'])
+        ep = watchlist[int(uin.replace('w',''))]
     else:
     else:
-        print(readlist[int(uin.replace('r',''))]['link'])
+        ep = readlist[int(uin.replace('r',''))]
+    print(link)
+    episode(sess,ep)
 
 
 def LesezeichenSingle(sess,mode):
 def LesezeichenSingle(sess,mode):
     response = sess.get('https://proxer.me/ucp?s=reminder&utm_source=nav#top')
     response = sess.get('https://proxer.me/ucp?s=reminder&utm_source=nav#top')
@@ -119,10 +141,13 @@ def LesezeichenD():
         print('r' + str(i) + ' - ' + readlist[i]['name'] + ' - ' + str(readlist[i]['new']))
         print('r' + str(i) + ' - ' + readlist[i]['name'] + ' - ' + str(readlist[i]['new']))
     print(str(readlist))
     print(str(readlist))
     uin = input('$>: ')
     uin = input('$>: ')
+    link = ''
     if uin[0] == 'w':
     if uin[0] == 'w':
-        print(watchlist[int(uin.replace('w',''))]['link'])
+        link = watchlist[int(uin.replace('w',''))]['link']
     else:
     else:
-        print(readlist[int(uin.replace('r',''))]['link'])
+        link = readlist[int(uin.replace('r',''))]['link']
+    print(link)
+    
     
     
 class episodeParser(HTMLParser):
 class episodeParser(HTMLParser):
     inScript = False
     inScript = False
@@ -189,7 +214,7 @@ class lesezeichenParser(HTMLParser):
                 self.anime['link'] = attrs[2][1]
                 self.anime['link'] = attrs[2][1]
 
 
         if self.inData and tag == 'img':
         if self.inData and tag == 'img':
-            if 'online' in attrs[0]:
+            if 'online' in attrs[0][1]:
                 self.anime['new'] = True
                 self.anime['new'] = True
             else:
             else:
                 self.anime['new'] = False
                 self.anime['new'] = False