|
|
@@ -9,6 +9,8 @@ def main():
|
|
|
print('PYrxoer Python wrapper for proxer.me')
|
|
|
print('1 - Login')
|
|
|
print('2 - Lesezeichen - Anime')
|
|
|
+ print('3 - Lesezeichen - dummy')
|
|
|
+ print('99 - exit')
|
|
|
|
|
|
uin = input('$>: ')
|
|
|
if uin == '1':
|
|
|
@@ -19,17 +21,34 @@ def main():
|
|
|
if uin == '2':
|
|
|
Lesezeichen(sess)
|
|
|
|
|
|
+ if uin == '3':
|
|
|
+ LesezeichenD()
|
|
|
+
|
|
|
+ if uin =='99':
|
|
|
+ exit()
|
|
|
+
|
|
|
def Lesezeichen(sess):
|
|
|
response = sess.get('https://proxer.me/ucp?s=reminder&utm_source=nav#top')
|
|
|
lpars = lesezeichenParser()
|
|
|
- lpars.feed(str(response.content))
|
|
|
-
|
|
|
-
|
|
|
-watchlist = []
|
|
|
-readlist = []
|
|
|
+ content = response.content
|
|
|
+ lpars.feed(str(content))
|
|
|
+ print(lparser.watchlist)
|
|
|
|
|
|
+def LesezeichenD():
|
|
|
+ lpars = lesezeichenParser()
|
|
|
+ f = open('dump.html','r')
|
|
|
+ content = f.readlines()
|
|
|
+ lpars.feed(str(content))
|
|
|
+ watchlist = lpars.watchlist
|
|
|
+ print(watchlist)
|
|
|
+ print('----------------------------')
|
|
|
+ for i in range (0,len(watchlist) - 1):
|
|
|
+ print(watchlist[i])
|
|
|
+ #print(str(i) + ' - ' + watchlist[i]['name'] + ' - ' + str(watchlist[i]['new']))
|
|
|
|
|
|
class lesezeichenParser(HTMLParser):
|
|
|
+ watchlist = []
|
|
|
+ readlist = []
|
|
|
inh4 = False
|
|
|
inWatchlist = False
|
|
|
inReadlist = False
|
|
|
@@ -37,7 +56,9 @@ class lesezeichenParser(HTMLParser):
|
|
|
inData = False
|
|
|
tdCount = 0
|
|
|
inName = False
|
|
|
+ anime = dict()
|
|
|
|
|
|
+
|
|
|
def handle_starttag(self, tag, attrs):
|
|
|
#headline to diff read/watchlist
|
|
|
if tag == 'h4':
|
|
|
@@ -47,6 +68,10 @@ class lesezeichenParser(HTMLParser):
|
|
|
if (self.inWatchlist or self.inReadlist) and tag == 'tr':
|
|
|
self.inRow = True
|
|
|
self.tdCount = 0
|
|
|
+ if self.inWatchlist:
|
|
|
+ print('new dict')
|
|
|
+ self.anime = dict()
|
|
|
+ print(self.anime)
|
|
|
|
|
|
#table data for parsing info
|
|
|
if self.inRow and tag == 'td':
|
|
|
@@ -55,7 +80,14 @@ class lesezeichenParser(HTMLParser):
|
|
|
|
|
|
if self.inData and tag == 'a' and self.tdCount == 2:
|
|
|
self.inName = True
|
|
|
+ if self.inWatchlist:
|
|
|
+ self.anime['link'] = attrs[2][1]
|
|
|
|
|
|
+ if self.inData and tag == 'img':
|
|
|
+ if 'online' in attrs[0]:
|
|
|
+ self.anime['new'] = True
|
|
|
+ else:
|
|
|
+ self.anime['new'] = False
|
|
|
|
|
|
def handle_endtag(self, tag):
|
|
|
if tag == 'h4' and self.inh4:
|
|
|
@@ -66,6 +98,9 @@ class lesezeichenParser(HTMLParser):
|
|
|
self.inWatchlist = False
|
|
|
if tag == 'tr' and self.inRow:
|
|
|
self.inRow = False
|
|
|
+ if self.inWatchlist:
|
|
|
+ print('adding ' + str(self.anime))
|
|
|
+ self.watchlist.append(self.anime)
|
|
|
if tag == 'td' and self.inData:
|
|
|
self.inData = False
|
|
|
if self.inName and tag == 'a':
|
|
|
@@ -82,6 +117,7 @@ class lesezeichenParser(HTMLParser):
|
|
|
|
|
|
if self.inName:
|
|
|
if self.inWatchlist:
|
|
|
+ self.anime['name'] = data
|
|
|
print(' Anime: '+data)
|
|
|
if self.inReadlist:
|
|
|
print(' Manga: '+data)
|