#
import sys
-import xbmcgui
-import xbmcplugin
import urllib,urllib2,re
+#from BeautifulSoup import BeautifulSoup
+from io import StringIO, BytesIO
+from lxml.html import parse
+#from lxml.html import document_fromstring
+from lxml import etree
+#from HTMLParser import HTMLParser
-def getUrl(url):
+def getUrl(url,exp=''):
req = urllib2.Request(url)
req.add_header('User-Agent', 'Kodi')
response = urllib2.urlopen(req)
content = response.read()
response.close()
+ if exp != '':
+ match = re.compile(exp,re.DOTALL).findall(content)
+ return match
return content
def getParams():
ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=True)
return ok
+def getVideos(url):
+ content = getUrl(url)
+ #tree = etree.HTML(content)
+ #return tree.cssselect('article')
+
+ #tree = parse(url).getroot()
+ #return tree
+ parser = etree.HTMLParser()
+ content = etree.tostring(content, encoding='unicode')
+ html = StringIO(content)
+ #tree = etree.parse(StringIO(content), parser)
+ #print tree
+ #tree.get('article')
+ #soup = BeautifulSoup(content)
+ #return soup.body.find('article', attrs={'class' : 'news-item'})
+ videos = []
+ #for item in content:
+
#
# Main
#
if True:
+ content = getVideos('https://news.nbdom.net/')
+ #print content
sys.exit(0)
+import xbmcgui
+import xbmcplugin
addon_handle = int(sys.argv[1])
xbmcplugin.setContent(addon_handle, 'movies')