from de.generia.kodi.plugin.backend.web.HtmlResource import HtmlResource

from de.generia.kodi.plugin.backend.zdf import stripHtml
from de.generia.kodi.plugin.backend.zdf.Regex import getTagPattern
from de.generia.kodi.plugin.backend.zdf.Regex import getTag
from de.generia.kodi.plugin.backend.zdf.Regex import compile

leftNavPattern = getTagPattern('ul', 'left-nav')
dropdownLinksPattern = compile(
    '<a\s*class="[^"]*dropdown-link[^"]*"[^>]*href="([^"]*)"[^>]*data-title="([^"]*)"'
)


class Rubric(object):
    def __init__(self, title, url):
        self.title = title
        self.url = url

    def __str__(self):
        return "<Rubric '%s' url='%s'>" % (self.title, self.url)


class NavigationResource(HtmlResource):
    def __init__(self, url):
        super(NavigationResource, self).__init__(url)

    def parse(self):
        super(NavigationResource, self).parse()
        leftNavMatch = leftNavPattern.search(self.content)
        if leftNavMatch is None:
            self.warn(
from sets import Set
from de.generia.kodi.plugin.backend.web.HtmlResource import HtmlResource

from de.generia.kodi.plugin.backend.zdf import stripHtml
from de.generia.kodi.plugin.backend.zdf.Regex import getTagPattern
from de.generia.kodi.plugin.backend.zdf.Regex import getTag
from de.generia.kodi.plugin.backend.zdf.Regex import compile

leftNavPattern = getTagPattern('ul', 'left-nav')
dropdownLinksPattern = compile('<a\s*class="[^"]*dropdown-link[^"]*"[^>]*href="([^"]*)"[^>]*data-title="([^"]*)"')

class Rubric(object):

    def __init__(self, title, url):
        self.title = title
        self.url = url
                        
    def __str__(self):
        return "<Rubric '%s' url='%s'>" % (self.title, self.url)
    
    
class NavigationResource(HtmlResource):

    def __init__(self, url):
        super(NavigationResource, self).__init__(url)

    def parse(self):
        super(NavigationResource, self).parse()
        leftNavMatch = leftNavPattern.search(self.content)
        if leftNavMatch is None:
            self.warn("can't find navigation in page '{}', no rubrics will be available ...", self.url)
from de.generia.kodi.plugin.backend.zdf.Regex import getTagPattern
from de.generia.kodi.plugin.backend.zdf.Regex import getTag
from de.generia.kodi.plugin.backend.zdf.Regex import compile
from de.generia.kodi.plugin.backend.zdf.Regex import stripTag

from de.generia.kodi.plugin.backend.zdf.Teaser import Teaser
from de.generia.kodi.plugin.backend.zdf.TeaserLazyload import TeaserLazyload

from urlparse import urlparse

fallbackTitlePattern = compile(
    '<li\s*class="item current"[^>]*>[^<]*<a[^>]*>([^<]*)</a>')
fallbackTitlePattern2 = compile(
    '<h\d\s*class="[^"]*stage-title[^"]*"[^>]*>([^<]*)</h\d>')

moduleItemPattern = getTagPattern('div', 'item-caption')
moduleItemTextPattern = compile(
    'class="item-description"[^>]*>([^<]*)</?[^>]*>')
moduleItemDatePattern = compile('<time[^>]*>([^<]*)</time>')
moduleItemImagePattern = compile(
    'class="item-img[^"]*"[^>]*data-srcset="([^"]*)"')
moduleItemVideoPattern = compile('&quot;1280x720&quot;:&quot;([^\?]*)\?cb')

postContentPattern = getTagPattern('div', 'details')

stageTeaserPattern = getTagPattern('div', 'title-table')
stageTeaserTextPattern = compile('class="teaser-text"[^>]*>([^<]*)</?[^>]*>')

listPattern = compile(
    'class="([^"]*b-cluster|[^"]*b-cluster\s[^"]*|[^"]*b-content-teaser-list[^"]*|[^"]*b-group-persons[^"]*|[^"]*b-post-content[^"]*|[^"]*b-(content|video)-module[^"]*|[^"]*stage-content[^"]|[^"]*(b-topics-module|b-newsstream)[^"]*)"[^>]*>'
)
Example #4
0
from datetime import datetime

from de.generia.kodi.plugin.backend.zdf import stripHtml
from de.generia.kodi.plugin.backend.zdf.Regex import getTagPattern
from de.generia.kodi.plugin.backend.zdf.Regex import getTag
from de.generia.kodi.plugin.backend.zdf.Regex import stripTag
from de.generia.kodi.plugin.backend.zdf.Regex import cleanTags
from de.generia.kodi.plugin.backend.zdf.Regex import compile

teaserPattern = getTagPattern('article', 'b-content-teaser-item')
sourcePattern = compile('class="m-16-9"[^>]*data-srcset="([^"]*)"')
labelPattern = getTagPattern('div', 'teaser-label')
iconPattern = compile('class="icon-[0-9]*_([^ ]*) icon">')
catPattern = compile('class="teaser-cat"[^>]*>([^<]*)</[^>]*>')
aPattern = compile('href="([^"]*)"[^>]*>')
titleIconPattern = compile('class="title-icon icon-[0-9]*_([^"]*)">')
textPattern = compile('class="teaser-text"[^>]*>([^<]*)</[^>]*>')
datePattern = compile('class="video-airing"[^>]*>([^<]*)</[^>]*>')

    
def compareTeasers(t1, t2):
    if t1 is None and t2 is None:
        return 0
    if t1 is None and t2 is not None:
        return 1
    if t1 is not None and t2 is None:
        return -1
    
    '''
    if t1.date is not None and t2.date is not None:
        d1 = datetime.strptime(t1.date, "%d.%m.%Y")
from de.generia.kodi.plugin.backend.zdf.AbstractPageResource import AbstractPageResource

from de.generia.kodi.plugin.backend.zdf import stripHtml
from de.generia.kodi.plugin.backend.zdf.Regex import getTagPattern
from de.generia.kodi.plugin.backend.zdf.Regex import getTag
from de.generia.kodi.plugin.backend.zdf.Regex import compile
from de.generia.kodi.plugin.backend.zdf.Teaser import Teaser

livetvCellPattern = getTagPattern('div', 'js-livetv-scroller-cell')
titlePattern = compile('<h2[^>]*>([^<]*)</h2>')
contentNamePattern = compile('"embed_content"\s*:\s*"([^"]*)"')
imagePattern = compile('data-src="([^"]*)"')


class LiveTvResource(AbstractPageResource):
    def __init__(self, url):
        super(LiveTvResource, self).__init__(url)

    def parse(self):
        super(LiveTvResource, self).parse()
        livetvCellMatch = livetvCellPattern.search(self.content)
        if livetvCellMatch is None:
            #self.warn("can't find live-tv cells in page '{}', no channels will be available ...", self.url)
            return

        self.teasers = []
        while livetvCellMatch is not None:
            pos = livetvCellMatch.end(0)
            teaser = Teaser()
            pos = self._parseTitle(pos, teaser)
            pos = self._parseContentName(pos, teaser)
Example #6
0
from de.generia.kodi.plugin.backend.web.HtmlResource import HtmlResource

from de.generia.kodi.plugin.backend.zdf import stripHtml
from de.generia.kodi.plugin.backend.zdf.Regex import getTagPattern
from de.generia.kodi.plugin.backend.zdf.Regex import getTag
from de.generia.kodi.plugin.backend.zdf.Regex import compile

from de.generia.kodi.plugin.backend.zdf.Teaser import Teaser

fallbackTitlePattern = compile(
    '<li\s*class="item current"[^>]*>[^<]*<a[^>]*>([^<]*)</a>')

moduleItemPattern = getTagPattern('div', 'item-caption')
moduleItemTextPattern = compile('class="item-description"[^>]*>([^<]*)<span')
moduleItemDatePattern = compile('<time[^>]*>([^<]*)</time>')

listPattern = compile(
    'class="([^"]*b-cluster|[^"]*b-cluster [^"]*|[^"]*b-content-teaser-list[^"]*|[^"]*b-content-module[^"]*)"[^>]*>'
)

sectionTitlePattern = compile(
    '<h2\s*class="[^"]*title[^"]*"[^>]*>([^<]*)</h2>')
sectionItemPattern = getTagPattern('article', 'b-content-teaser-item')

clusterTitlePattern = compile(
    '<h2\s*class="[^"]*cluster-title[^"]*"[^>]*>([^<]*)</h2>')
clusterItemPattern = getTagPattern('article', 'b-cluster-teaser')


class Cluster(object):
    def __init__(self, title, listType, listStart, listEnd=-1):
Example #7
0
from datetime import datetime

from de.generia.kodi.plugin.backend.zdf import stripHtml
from de.generia.kodi.plugin.backend.zdf.Regex import getTagPattern
from de.generia.kodi.plugin.backend.zdf.Regex import getTag
from de.generia.kodi.plugin.backend.zdf.Regex import stripTag
from de.generia.kodi.plugin.backend.zdf.Regex import cleanTags
from de.generia.kodi.plugin.backend.zdf.Regex import compile

teaserPattern = getTagPattern('article', 'b-content-teaser-item')
sourcePattern = compile('class="m-16-9"[^>]*data-srcset="([^"]*)"')
labelPattern = getTagPattern('div', 'teaser-label')
iconPattern = compile('class="icon-[0-9]*_([^ ]*) icon">')
catPattern = compile('class="teaser-cat\s*[^"]*"[^>]*>')
catCategoryPattern = compile(
    'class="teaser-cat-category\s*[^"]*"[^>]*>([^<]*)</[^>]*>')
catBrandPattern = compile(
    'class="teaser-cat-brand\s*[^"]*"[^>]*>([^<]*)</[^>]*>')
aPattern = compile('href="([^"]*)"[^>]*>')
textPattern = compile('class="teaser-text"[^>]*>([^<]*)</[^>]*>')
footPattern = compile('class="teaser-foot\s*[^"]*"[^>]*>')
footIconPattern = compile('class="[^"]*icon-[0-9]*_(play)[^"]*">')
teaserInfoPattern = getTagPattern('dd', 'teaser-info')
teaserInfoIsTiviPattern = getTagPattern('span', 'is-tivi')
teaserInfoDurationPattern = compile('(.*) min')
teaserInfoEpisodePattern = compile('S(..) F(..)')
apiTokenPattern = compile('"apiToken"\s*:\s*"([^"]*)"')


def compareTeasers(t1, t2):
    if t1 is None and t2 is None:
from datetime import datetime

from de.generia.kodi.plugin.backend.zdf import stripHtml
from de.generia.kodi.plugin.backend.zdf.Regex import getTagPattern
from de.generia.kodi.plugin.backend.zdf.Regex import getTag
from de.generia.kodi.plugin.backend.zdf.Regex import stripTag
from de.generia.kodi.plugin.backend.zdf.Regex import cleanTags
from de.generia.kodi.plugin.backend.zdf.Regex import compile

teaserPattern = getTagPattern('article', 'b-content-teaser-item')
sourcePattern = compile('class="m-16-9"[^>]*data-srcset="([^"]*)"')
labelPattern = getTagPattern('div', 'teaser-label')
iconPattern = compile('class="icon-[0-9]*_([^ ]*) icon">')
catPattern = compile('class="teaser-cat\s*[^"]*"[^>]*>')
catCategoryPattern = compile(
    'class="teaser-cat-category\s*[^"]*"[^>]*>([^<]*)</[^>]*>')
catBrandPattern = compile(
    'class="teaser-cat-brand\s*[^"]*"[^>]*>([^<]*)</[^>]*>')
aPattern = compile('href="([^"]*)"[^>]*>')
textPattern = compile('class="teaser-text"[^>]*>([^<]*)</[^>]*>')
footPattern = compile('class="teaser-foot"[^>]*>')
footIconPattern = compile('class="[^"]*icon-[0-9]*_(play)[^"]*">')
datePattern = compile('class="teaser-info"[^>]*>([^<]*)</[^>]*>')
apiTokenPattern = compile('"apiToken"\s*:\s*"([^"]*)"')


def compareTeasers(t1, t2):
    if t1 is None and t2 is None:
        return 0
    if t1 is None and t2 is not None:
        return 1
Example #9
0
from de.generia.kodi.plugin.backend.web.HtmlResource import HtmlResource

from de.generia.kodi.plugin.backend.zdf import stripHtml
from de.generia.kodi.plugin.backend.zdf.Regex import getTagPattern
from de.generia.kodi.plugin.backend.zdf.Regex import getTag
from de.generia.kodi.plugin.backend.zdf.Regex import compile
from de.generia.kodi.plugin.backend.zdf.Teaser import Teaser

livetvCellPattern = getTagPattern('div', 'js-livetv-scroller-cell')
titlePattern = compile('<h2[^>]*>([^<]*)</h2>')
contentNamePattern = compile('data-zdfplayer-id="([^"]*)"')
imagePattern = compile('data-src="([^"]*)"')


class LiveTvResource(HtmlResource):

    def __init__(self, url):
        super(LiveTvResource, self).__init__(url)

    def parse(self):
        super(LiveTvResource, self).parse()
        livetvCellMatch = livetvCellPattern.search(self.content)
        if livetvCellMatch is None:
            #self.warn("can't find live-tv cells in page '{}', no channels will be available ...", self.url)
            return
        
        self.teasers = []
        while livetvCellMatch is not None:
            pos = livetvCellMatch.end(0)
            teaser = Teaser()
            pos = self._parseTitle(pos, teaser)
Example #10
0
from de.generia.kodi.plugin.backend.web.HtmlResource import HtmlResource

from de.generia.kodi.plugin.backend.zdf import stripHtml
from de.generia.kodi.plugin.backend.zdf.Regex import getTagPattern
from de.generia.kodi.plugin.backend.zdf.Regex import getTag
from de.generia.kodi.plugin.backend.zdf.Regex import compile

from de.generia.kodi.plugin.backend.zdf.Teaser import Teaser

fallbackTitlePattern = compile('<li\s*class="item current"[^>]*>[^<]*<a[^>]*>([^<]*)</a>')
fallbackTitlePattern2 = compile('<h\d\s*class="[^"]*stage-title[^"]*"[^>]*>([^<]*)</h\d>')

moduleItemPattern = getTagPattern('div', 'item-caption')
moduleItemTextPattern = compile('class="item-description"[^>]*>([^<]*)<span')
moduleItemDatePattern = compile('<time[^>]*>([^<]*)</time>')

listPattern = compile('class="([^"]*b-cluster|[^"]*b-cluster [^"]*|[^"]*b-content-teaser-list[^"]*|[^"]*b-content-module[^"]*)"[^>]*>')

sectionTitlePattern = compile('<h2\s*class="[^"]*title[^"]*"[^>]*>([^<]*)</h2>')
sectionItemPattern = getTagPattern('article', 'b-content-teaser-item')

clusterTitlePattern = compile('<h2\s*class="[^"]*cluster-title[^"]*"[^>]*>([^<]*)</h2>')
clusterItemPattern = getTagPattern('article', 'b-cluster-teaser')

class Cluster(object):

    def __init__(self, title, listType, listStart, listEnd=-1):
        self.title = title
        self.listType = listType
        self.listStart = listStart
        self.listEnd = listEnd