Beta commit
[telefricabot.git/.git] / api.py
diff --git a/api.py b/api.py
index d851d1b..a330365 100644 (file)
--- a/api.py
+++ b/api.py
@@ -1,3 +1,4 @@
+
 import requests,io,random,re
 
 ua = 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:60.0) Gecko/20100101'
@@ -38,4 +39,18 @@ class FriendApi():
                        else:
                                out=out+'\n'+'\n'+i.replace(re.findall('"><img src=".*" aria-hidden="true" class="notif-image">',i)[0],' ').replace('<span class="notif-when">','').replace('</span></a>','')
                return out
-
+       def network(self,limit):
+               texto=self.session.get('https://friendicarg.nsupdate.info/network').text
+               exp=re.findall('<div class="wall-item-body e-content p-name">.*</div>',texto)
+               exp1=re.findall('"display/.*"',texto)
+               out=[]
+               for i in re.findall('<a href=".*" class="tag" title=".*">',texto):
+                       texto=texto.replace(i,'')
+               for i in re.findall('<img src=".*" alt=".*" title=".*">',texto):
+                       texto.replace(i,'')
+               for i in range(0,limit):
+                       try:
+                               out.append(exp[i].replace('</a>','').replace('</div>','').replace('<div class="wall-item-body e-content p-name">','').replace('<br>','')+'\n'+self.url+exp1[i].replace('"','').replace('><i class=icon-link icon-large><span class=ser-only','')+'\n\n')
+                       except:
+                               break
+               return out