• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python util.substr函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中util.substr函数的典型用法代码示例。如果您正苦于以下问题:Python substr函数的具体用法?Python substr怎么用?Python substr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了substr函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: film

	def film(self,page):
		result=[]
		
		data = util.substr(page,self.od,self.do)
		pattern='background: url\((?P<img>.+?)\)[\s|\S]*?<h2><a href=\"(?P<url>.+?)\".[^>]+>(?P<name>.+?)</a></h2>'
		for m in re.finditer(pattern,data,re.IGNORECASE | re.DOTALL ):
			item = self.video_item()
			item['url'] = m.group('url')
			item['title'] = m.group('name')
			item['img'] = m.group('img')
			result.append(item)
		data = util.substr(page,'<div class=\'wp-pagenavi\'>','<div id=\"sidebar\">')
		pattern='<span class=\'pages\'>(?P<pg>.+?)</span>'
		m = re.search(pattern, data, re.IGNORECASE | re.DOTALL)
		last_page=''
		if not m == None:
			last_page=m.group('pg').split(' ')
			next_page=int(last_page[1])+1
			last_page=last_page[-1]
		
		pattern = 'href=\"(?P<url>.+?)\".?><div class=\"next"></div>'
		m = re.search(pattern, data, re.IGNORECASE | re.DOTALL)
		next_url=''
		if not m == None:
			next_url=m.group('url')
			try:	
				item = self.dir_item()
				item['title'] = 'Přejít na stranu '+ str(next_page)+' z '+ str(last_page)
				item['url'] = '#film#'+next_url
				result.append(item)
			except:
				pass
		
		return result
开发者ID:cplaiasu,项目名称:xbmc-doplnky,代码行数:34,代码来源:najfilmy.py


示例2: _search_person_cb

def _search_person_cb(what):
    print "searching for " + what
    page = util.request(BASE_URL + "hledat/complete-films/?q=" + urllib.quote(what))

    results = []
    data = util.substr(page, '<div id="search-creators', '<div class="footer')
    for m in re.finditer(
        '<h3 class="subject"[^<]+<a href="(?P<url>[^"]+)[^>]+>(?P<name>[^<]+).+?<p>(?P<info>[^<]+)',
        data,
        re.DOTALL | re.IGNORECASE,
    ):
        results.append((m.group("url"), m.group("name") + " (" + m.group("info") + ")"))

    for m in re.finditer(
        "<li(?P<item>.+?)</li>", util.substr(data, '<ul class="creators others', "</div"), re.DOTALL | re.IGNORECASE
    ):
        base = re.search('<a href="(?P<url>[^"]+)[^>]+>(?P<name>[^<]+)', m.group("item"))
        if base:
            name = base.group("name")
            for n in re.finditer("<span[^>]*>(?P<data>[^<]+)", m.group("item")):
                name = "%s %s" % (name, n.group("data"))
            results.append((base.group("url"), name))
    for url, name in results:
        info = scrapper._empty_info()
        info["url"] = url
        add_person(name, info)
    xbmcplugin.endOfDirectory(int(sys.argv[1]))
开发者ID:lzoubek,项目名称:xbmc-doplnky-old,代码行数:27,代码来源:default.py


示例3: list_show_page

 def list_show_page(self, url, page, seasons=False, episodes=False):
     result = []
     if "/p/epizody" in url or "/p/epiz%C3%B3dy" in url or "p/archiv" in url:
         if seasons:
             season_data = util.substr(page, SERIES_START2, SERIES_END2)
             for m in re.finditer(SERIES_ITER_RE2, season_data, re.DOTALL | re.IGNORECASE):
                 item = self.dir_item()
                 item['title'] = m.group('title')
                 item['url'] = url + '#post=%s' % (m.group('id'))
                 self._filter(result, item)
         if episodes:
             for m in re.finditer(EPISODE_ITER_RE2, page, re.DOTALL | re.IGNORECASE):
                 item = self.video_item()
                 item['title'] = "%s (%s)" % (m.group('title'), m.group('date'))
                 item['url'] = m.group('url')
                 self._filter(result, item)
     else:
         if seasons:
             season_data = util.substr(page, SERIES_START, SERIES_END)
             for m in re.finditer(SERIES_ITER_RE, season_data, re.DOTALL | re.IGNORECASE):
                 item = self.dir_item()
                 item['title'] = m.group('title')
                 item['url'] = 'http://' + urlparse.urlparse(url).netloc + '/ajax.json?' + m.group('url')
                 self._filter(result, item)
         if episodes:
             episodes_data = util.substr(page, EPISODE_START, EPISODE_END)
             for m in re.finditer(EPISODE_ITER_RE, page, re.DOTALL | re.IGNORECASE):
                 item = self.video_item()
                 item['title'] = "%s. %s (%s)" % (m.group('episode'), m.group('title'), m.group('date'))
                 item['url'] = m.group('url')
                 self._filter(result, item)
     return result
开发者ID:Jakub2013,项目名称:plugin.video.joj.sk,代码行数:32,代码来源:joj.py


示例4: _search_movie_cb

def _search_movie_cb(what):
    print "searching for movie " + what
    url = BASE_URL + "hledat/complete-films/?q=" + urllib.quote(what)
    page = util.request(url)

    results = []
    data = util.substr(page, '<div id="search-films', '<div class="footer')
    for m in re.finditer(
        '<h3 class="subject"[^<]+<a href="(?P<url>[^"]+)[^>]+>(?P<name>[^<]+).+?<p>(?P<info>[^<]+)',
        data,
        re.DOTALL | re.IGNORECASE,
    ):
        results.append((m.group("url"), "%s (%s)" % (m.group("name"), m.group("info"))))

    for m in re.finditer(
        "<li(?P<item>.+?)</li>", util.substr(data, '<ul class="films others', "</div"), re.DOTALL | re.IGNORECASE
    ):
        base = re.search('<a href="(?P<url>[^"]+)[^>]+>(?P<name>[^<]+)', m.group("item"))
        if base:
            name = base.group("name")
            for n in re.finditer("<span[^>]*>(?P<data>[^<]+)", m.group("item")):
                name = "%s %s" % (name, n.group("data"))
            results.append((base.group("url"), name))
    if preload():
        return preload_items(results)
    add_items(results)
    xbmcplugin.endOfDirectory(int(sys.argv[1]))
开发者ID:lzoubek,项目名称:xbmc-doplnky-old,代码行数:27,代码来源:default.py


示例5: list

 def list(self, url):
     if url.find("#fm#") == 0:
         return self.list_folder(url[5:])
     url = self._url(url)
     page = util.request(
         url, headers={"X-Requested-With": "XMLHttpRequest", "Referer": url, "Cookie": "uloz-to-id=1561277170;"}
     )
     script = util.substr(page, "var kn", "</script>")
     keymap = None
     key = None
     k = re.search('{([^\;]+)"', script, re.IGNORECASE | re.DOTALL)
     if k:
         keymap = json.loads("{" + k.group(1) + '"}')
     j = re.search('kapp\(kn\["([^"]+)"', script, re.IGNORECASE | re.DOTALL)
     if j:
         key = j.group(1)
     if not (j and k):
         self.error("error parsing page - unable to locate keys")
         return []
     burl = b64decode("I2h0dHA6Ly9kZWNyLWNlY2gucmhjbG91ZC5jb20vZGVjcnlwdC8/a2V5PSVzJnZhbHVlPSVz")
     murl = b64decode("aHR0cDovL2RlY3ItY2VjaC5yaGNsb3VkLmNvbS9kZWNyeXB0Lw==")
     data = util.substr(page, '<ul class="chessFiles', "</ul>")
     result = []
     req = {"seed": keymap[key], "values": keymap}
     decr = json.loads(util.post_json(murl, req))
     for li in re.finditer('<li data-icon="(?P<key>[^"]+)', data, re.IGNORECASE | re.DOTALL):
         body = urllib.unquote(b64decode(decr[li.group("key")]))
         m = re.search(
             '<li>.+?<div data-icon="(?P<key>[^"]+)[^<]+<img(.+?)src="(?P<logo>[^"]+)(.+?)<div class="fileInfo(?P<info>.+?)</h4>',
             body,
             re.IGNORECASE | re.DOTALL,
         )
         if not m:
             continue
         value = keymap[m.group("key")]
         info = m.group("info")
         iurl = burl % (keymap[key], value)
         item = self.video_item()
         item["title"] = ".. title not found.."
         title = re.search('<div class="fileName.+?<a[^>]+>(?P<title>[^<]+)', info, re.IGNORECASE | re.DOTALL)
         if title:
             item["title"] = title.group("title")
         size = re.search('<span class="fileSize[^>]+>(?P<size>[^<]+)', info, re.IGNORECASE | re.DOTALL)
         if size:
             item["size"] = size.group("size").strip()
         time = re.search('<span class="fileTime[^>]+>(?P<time>[^<]+)', info, re.IGNORECASE | re.DOTALL)
         if time:
             item["length"] = time.group("time")
         item["url"] = iurl
         item["img"] = m.group("logo")
         self._filter(result, item)
     # page navigation
     data = util.substr(page, '<div class="paginator', "</div")
     mnext = re.search('<a href="(?P<url>[^"]+)" class="next', data)
     if mnext:
         item = self.dir_item()
         item["type"] = "next"
         item["url"] = mnext.group("url")
         result.append(item)
     return result
开发者ID:lzoubek,项目名称:xbmc-doplnky-old,代码行数:60,代码来源:ulozto.py


示例6: show

    def show(self, page):
        result = []
        data = util.substr(page, '<div id="search', "<hr>")
        for m in re.finditer(
            '<div.+?class="scene[^>]*>.+?<img src="(?P<img>[^"]+)" alt="(?P<name>[^"]+).+?<div class="sc-name">(?P<author>[^<]+).+?<a href="(?P<url>[^"]+)',
            data,
            re.IGNORECASE | re.DOTALL,
        ):
            name = "%s (%s)" % (m.group("name"), m.group("author"))
            item = self.video_item()
            item["title"] = name
            item["url"] = m.group("url")
            item["img"] = m.group("img")
            self._filter(result, item)

        data = util.substr(page, 'class="pages">', "</div>")
        next = re.search('<a href="(?P<url>[^"]+)"[^<]+<img src="/images/page-right.gif', data)
        prev = re.search('<a href="(?P<url>[^"]+)"[^<]+<img src="/images/page-left.gif', data)
        if prev:
            item = self.dir_item()
            item["type"] = "prev"
            item["url"] = prev.group("url")
            result.append(item)
        if next:
            item = self.dir_item()
            item["type"] = "next"
            item["url"] = next.group("url")
            result.append(item)
        return result
开发者ID:lzoubek,项目名称:xbmc-doplnky-old,代码行数:29,代码来源:nastojaka.py


示例7: list

	def list(self,url):
		result = []
		url = self._url(url)
		page = util.request(url)
		q = url.find('?')
		if q > 0:
			url = url[:q]
		data = util.substr(page,'<div id=\"videolist','<div class=\"paging-adfox\">')
		pattern='<div class=\"img-wrapper\"><a href=\"(?P<url>[^\"]+)\" title=\"(?P<name>[^\"]+)(.+?)<img(.+?)src=\"(?P<img>[^\"]+)(.+?)<p class=\"dsc\">(?P<plot>[^<]+)'
		for m in re.finditer(pattern, data, re.IGNORECASE | re.DOTALL):
			item = self.video_item()
			item['title'] = m.group('name')
			item['url'] = m.group('url')
			item['img'] = m.group('img')
			item['plot'] = m.group('plot')
			self._filter(result,item)

		data = util.substr(page,'<div class=\"jumpto\"','</div>')
	
		data = util.substr(page,'<p class=\"paging','</p>')
		next = re.search('<a href=\"(?P<url>[^\"]+)\"><img(.+?)next\.png',data,re.IGNORECASE | re.DOTALL)
		if next:
			item = self.dir_item()
			item['type'] = 'next'
			item['url'] = url+next.group('url')
			result.append(item)
		return result
开发者ID:skata890,项目名称:xbmc-doplnky,代码行数:27,代码来源:zkouknito.py


示例8: list_by_letter

 def list_by_letter(self, url):
     result = []
     page = self.get_data_cached(url)
     data = util.substr(page, '<ul class=\"content', '</ul>')
     subs = self.get_subs()
     for m in re.finditer('<a class=\"title\" href=\"(?P<url>[^\"]+)[^>]+>(?P<name>[^<]+)', data,
                          re.IGNORECASE | re.DOTALL):
         item = {'url': m.group('url'), 'title': m.group('name')}
         if item['url'] in subs:
             item['menu'] = {"[B][COLOR red]Remove from subscription[/COLOR][/B]": {
                 'url': m.group('url'), 'action': 'remove-subscription', 'name': m.group('name')}
             }
         else:
             item['menu'] = {"[B][COLOR red]Add to library[/COLOR][/B]": {
                 'url': m.group('url'), 'action': 'add-to-library', 'name': m.group('name')}}
         self._filter(result, item)
     paging = util.substr(page, '<div class=\"pagination\"', '</div')
     next = re.search('<li class=\"next[^<]+<a href=\"\?page=(?P<page>\d+)', paging,
                      re.IGNORECASE | re.DOTALL)
     if next:
         next_page = int(next.group('page'))
         current = re.search('\?page=(?P<page>\d)', url)
         current_page = 0
         if self.is_most_popular(url) and next_page > 10:
             return result
         if current:
             current_page = int(current.group('page'))
         if current_page < next_page:
             url = re.sub('\?.+?$', '', url) + '?page=' + str(next_page)
             result += self.list_by_letter(url)
     return result
开发者ID:CZ-2W,项目名称:plugin.video.prehraj.me,代码行数:31,代码来源:prehrajme.py


示例9: filmoteka

def filmoteka(p):
    if p["filmoteka"] == "":
        data = login()
        if data:
            userid = get_userid(data)
            if userid:
                page = util.request(furl(userid + "filmoteka"))
                data = util.substr(page, '<select name="filter', "</select>")
                for m in re.finditer(
                    '<option value="(?P<value>[^"]+)[^>]+>(?P<name>[^<]+)', data, re.DOTALL | re.IGNORECASE
                ):
                    p["filmoteka"] = userid + "filmoteka/filtr-" + m.group("value")
                    xbmcutil.add_dir(m.group("name"), p)
                xbmcplugin.endOfDirectory(int(sys.argv[1]))
    else:
        page = login(p["filmoteka"])
        data = util.substr(page, '<table class="ui-table-list', "</table")
        results = []
        for m in re.finditer(
            '<tr[^<]+<td>(?P<added>[^<]+)</td[^<]+<td[^<]+<a href="(?P<url>[^"]+)[^>]+>(?P<name>[^<]+)',
            data,
            re.DOTALL | re.IGNORECASE,
        ):
            results.append((m.group("url"), m.group("name")))
        if preload():
            return preload_items(results)
        add_items(results)
        xbmcplugin.endOfDirectory(int(sys.argv[1]))
开发者ID:lzoubek,项目名称:xbmc-doplnky-old,代码行数:28,代码来源:default.py


示例10: list_archive_page

 def list_archive_page(self, show_page, showon=False, showoff=False):
     showonlist = []
     if showon:
         page = util.substr(show_page, VYSIELANE_START, NEVYSIELANE_START)
         for m in re.finditer(VYSIELANE_ITER_RE, page, re.DOTALL | re.IGNORECASE):
             item = self.dir_item()
             item['title'] = m.group('title')
             item['plot'] = m.group('desc')
             item['url'] = m.group('url') + "#season_episode"
             if m.group('itime') is not None:
                 item['type'] = "showon7d"
             else:
                 item['type'] = "showon"
             showonlist.append(item)
     showonlist.sort(key=lambda x: x['title'].lower())
     showofflist = []
     if showoff:
         page = util.substr(show_page, NEVYSIELANE_START, NEVYSIELANE_END)
         for m in re.finditer(NEVYSIELANE_ITER_RE, page, re.DOTALL | re.IGNORECASE):
             item = self.dir_item()
             item['title'] = m.group('title')
             item['url'] = m.group('url') + "#season_episode"
             item['type'] = "showoff"
             showofflist.append(item)
     showofflist.sort(key=lambda x: x['title'].lower())
     result = showonlist + showofflist
     return result
开发者ID:Jakub2013,项目名称:plugin.video.joj.sk,代码行数:27,代码来源:joj.py


示例11: list_content

 def list_content(self, page, url=None):
     result = []
     if not url: url = self.base_url
     data = util.substr(page, '<div class=\"items no-wrapper no-padder', '<div class=\"my-pagination>')
     pattern = '<article class=\"video\".+?<a href=\"(?P<url>[^\"]+)\" *title=\"(?P<title>[^\"]+)\"(.+?)<img src=\"(?P<img>[^\"]+)\".+?<p>(?P<plot>[^<]+?)<\/p>.+?<li class=\"i-published\".+?title=\"(?P<date>[^\"]+)\"'
     for m in re.finditer(pattern, data, re.IGNORECASE | re.DOTALL):
         item = self.video_item()
         item['title'] = m.group('title')
         item['img'] = m.group('img').strip()
         item['plot'] = self.decode_plot(m.group('plot'))
         item['url'] = self.base_url[:-1] + m.group('url')
         item['menu'] = {'$30060':{'list':'#related#' + item['url'], 'action-type':'list'}}
         print item
         self._filter(result, item)
     data = util.substr(page, '<ul class=\"my-pagination', '</div>')
     n = re.search('<li class=\"paginate_button previous *\"[^<]+<a href=\"(?P<url>[^\"]+)\">(?P<name>[^<]+)<', data)
     k = re.search('<li class=\"paginate_button next *\"[^<]+<a href=\"(?P<url>[^\"]+)\">(?P<name>[^<]+)<', data)
     if not n == None:
         item = self.dir_item()
         item['type'] = 'prev'
         # item['title'] = '%s - %s' % (m.group(1), n.group('name'))
         item['url'] = n.group('url')
         result.append(item)
     if not k == None:
         item = self.dir_item()
         item['type'] = 'next'
         # item['title'] = '%s - %s' % (m.group(1), k.group('name'))
         item['url'] = k.group('url')
         result.append(item)
     return result
开发者ID:mx3L,项目名称:archivczsk-doplnky,代码行数:30,代码来源:videacesky.py


示例12: list_episodes

 def list_episodes(self, url, page=0):
     result = []
     if url.find('ajax.json') != -1:
         headers = {'X-Requested-With':'XMLHttpRequest',
                    'Referer':util.substr(url, url, url.split('/')[-1])
                    }
         httpdata = util.request(url, headers)
         httpdata = util.json.loads(httpdata)['content']
     else:
         httpdata = util.request(url)
         httpdata = util.substr(httpdata, EPISODE_START, EPISODE_END)
        
     entries = 0
     skip_entries = MAX_PAGE_ENTRIES * page
 
     for m in re.finditer(EPISODE_ITER_RE, httpdata, re.DOTALL | re.IGNORECASE):
         entries += 1
         if entries < skip_entries:
             continue
         item = self.video_item()
         item['title'] = "%s. %s (%s)" % (m.group('episode'), m.group('title'), m.group('date'))
         item['url'] = m.group('url')
         self._filter(result, item)
         if entries >= (skip_entries + MAX_PAGE_ENTRIES):
             page += 1
             item = self.dir_item()
             item['type'] = 'next'
             item['url'] = "#episodes##%d#" % (page) + url
             result.append(item)
             break
     return result
开发者ID:mx3L,项目名称:xbmc-doplnky,代码行数:31,代码来源:joj.py


示例13: list_content

 def list_content(self, page):
     result = []
     data = util.substr(page, LISTING_START, LISTING_END)
     for m in re.finditer(LISTING_ITER_RE, data, re.DOTALL | re.VERBOSE):
         item = self.video_item()
         item['title'] = "%s - (%s)" % (m.group('title').strip(), m.group('date').strip())
         item['img'] = m.group('img')
         item['url'] = m.group('url')
         if 'section_title' in m.groupdict() and 'section_url' in m.groupdict():
             item['menu'] = {"Sekcia - "+m.group('section_title'):{'list':m.group('section_url'), 'action-type':'list'}}
         self._filter(result, item)
     pager_data = util.substr(page, PAGER_START, PAGER_END)
     for m in re.finditer("<a.+?</a>", pager_data, re.DOTALL):
         p = re.search(PAGE_PREV_RE, m.group(), re.DOTALL)
         n = re.search(PAGE_NEXT_RE, m.group(), re.DOTALL)
         if p:
             item = self.dir_item()
             item['type'] = 'prev'
             item['url'] = p.group('url')
             result.append(item)
         if n:
             item = self.dir_item()
             item['type'] = 'next'
             item['url'] = n.group('url')
             result.append(item)
     return result
开发者ID:Pepo48,项目名称:plugin.video.markiza.sk,代码行数:26,代码来源:markiza.py


示例14: list

	def list(self,url):
		result = []
		url = self._url(url)
		print url
		page = util.request(url)
		data = util.substr(page,'<div id=\"archive','end #archive')
		pattern = '<div class=\"cover\"><a href=\"(?P<url>[^\"]+)(.+?)title=\"(?P<name>[^\"]+)(.+?)<img src=\"(?P<logo>[^\"]+)(.+?)<p class=\"postmetadata\">(?P<fired>[^<]+)(.+?)<p>(?P<plot>[^<]+)'
		for m in re.finditer(pattern, data, re.IGNORECASE | re.DOTALL):
			name = ('%s - %s' % (m.group('name'),m.group('fired').replace('/',''))).strip()
			item = self.video_item()
			item['title'] = name
			item['img'] = m.group('logo')
			item['plot'] = m.group('plot')
			item['url'] = m.group('url')
			self._filter(result,item)
	
		data = util.substr(page,'<div class=\"navigation\">','</div>')
		type = 'next'
		for m in re.finditer('<a href=\"(.+?)(?P<page>/page/[\d]+)',data,re.IGNORECASE | re.DOTALL):
			item = self.dir_item()
			item['type'] = type
			if type == 'next':
				type = 'prev'
			item['url'] = m.group('page')
			result.append(item)
		return result
开发者ID:cplaiasu,项目名称:xbmc-doplnky,代码行数:26,代码来源:replay.py


示例15: list_content

 def list_content(self, page, url=None):
     result = []
     if not url: url = self.base_url
     data = util.substr(page, '<div class=\"contentArea', '<div class=\"pagination\">')
     pattern = '<h\d class=\"postTitle\"><a href=\"(?P<url>[^\"]+)(.+?)<span>(?P<title>[^<]+)</span></a></h\d>(.+?)<span class=\"postDate\">(?P<date>[^\<]+)</span>(.+?)<div class=\"postContent">[^<]+<a[^>]+[^<]+<img src=\"(?P<img>[^\"]+)(.+?)<div class=\"obs\">(?P<plot>.+?)</div>'
     for m in re.finditer(pattern, data, re.IGNORECASE | re.DOTALL):
         plot = re.sub('<br[^>]*>', '', m.group('plot'))
         item = self.video_item()
         item['title'] = m.group('title')
         item['img'] = m.group('img')
         item['plot'] = plot
         item['url'] = m.group('url')
         self._filter(result, item)
     data = util.substr(page, '<div class=\"pagination\">', '</div>')
     m = re.search('<li class=\"info\"><span>([^<]+)', data)
     n = re.search('<li class=\"prev\"[^<]+<a href=\"(?P<url>[^\"]+)[^<]+<span>(?P<name>[^<]+)', data)
     k = re.search('<li class=\"next\"[^<]+<a href=\"(?P<url>[^\"]+)[^<]+<span>(?P<name>[^<]+)', data)
     # replace last / + everyting till the end
     #myurl = re.sub('\/[\w\-]+$', '/', url)
     if not m == None:
         if not n == None:
             item = self.dir_item()
             item['type'] = 'prev'
             #item['title'] = '%s - %s' % (m.group(1), n.group('name'))
             item['url'] = n.group('url')
             result.append(item)
         if not k == None:
             item = self.dir_item()
             item['type'] = 'next'
             #item['title'] = '%s - %s' % (m.group(1), k.group('name'))
             item['url'] = k.group('url')
             result.append(item)
     return result
开发者ID:mx3L,项目名称:xbmc-doplnky,代码行数:33,代码来源:videacesky.py


示例16: list_movie_recently_added

 def list_movie_recently_added(self, url):
     result = []
     page = self.get_data_cached(url)
     data = util.substr(page, '<div class=\"content\"', '</ul>')
     for m in re.finditer(
             '<a class=\"content-block\" href=\"(?P<url>[^\"]+)\" title=\"(?P<name>[^\"]+)',
             data, re.IGNORECASE | re.DOTALL):
         item = self.video_item()
         item['url'] = m.group('url')
         item['title'] = m.group('name')
         item['menu'] = {"[B][COLOR red]Add to library[/COLOR][/B]": {
             'url': m.group('url'), 'action': 'add-to-library', 'name': m.group('name')}}
         self._filter(result, item)
     paging = util.substr(page, '<div class=\"pagination\"', '</div')
     next = re.search('<li class=\"next[^<]+<a href=\"\?page=(?P<page>\d+)', paging,
                      re.IGNORECASE | re.DOTALL)
     if next:
         next_page = int(next.group('page'))
         current = re.search('\?page=(?P<page>\d)', url)
         current_page = 0
         if next_page > 5:
             return result
         if current:
             current_page = int(current.group('page'))
         if current_page < next_page:
             url = re.sub('\?.+?$', '', url) + '?page=' + str(next_page)
             result += self.list_movie_recently_added(url)
     return result
开发者ID:CZ-2W,项目名称:plugin.video.prehraj.me,代码行数:28,代码来源:prehrajme.py


示例17: list_videos

 def list_videos(self, url):
     result = []
     page = util.request(url)
     data = util.substr(page, '<div class="articles">','<div class="paginator">')
     listing_iter_re = r"""
         <article\ class=\"row\">.+?
             <a\ href=\"(?P<url>[^\"]+)\"><i\ class=\"ta3-icon-video\"[^>]+>[^>]+>(?P<title>[^<]+)</a>.+?
         </article> """
     for m in re.finditer(listing_iter_re, data, re.DOTALL | re.VERBOSE):
         item = self.video_item()
         item['title'] = m.group('title').strip()
         #item['title'] = "%s (%s)" % (m.group('title').strip(), m.group('date').strip())
         item['url'] = m.group('url')
         self._filter(result, item)
     pager_data = util.substr(page,'<div class="paginator">', '</div>')
     next_page_match = re.search(r'<li class="next"><a href="(?P<url>[^"]+)', pager_data)
     if next_page_match:
         item = self.dir_item()
         item['type'] = 'next'
         next_url = next_page_match.group('url').replace('&amp;','&')
         # ta3.com gives invalid page urls for publicistika
         if "publicistika.html" in url:
             purl = urlparse.urlparse(url)
             pnext_url = urlparse.urlparse(next_url)
             next_url = "http://" + purl.netloc + purl.path + "?" + pnext_url.query
         item['url'] = next_url
         self._filter(result, item)
     return result
开发者ID:kodi-czsk,项目名称:plugin.video.ta3.com,代码行数:28,代码来源:ta3.py


示例18: resolve

 def resolve(self,item,captcha_cb=None,select_cb=None):
     item = item.copy()
     url = self._url(item['url']).replace('×', '%c3%97')
     data = util.substr(util.request(url), '<div id=\"content\"', '#content')
     visionone_resolved, onevision_resolved, scz_resolved = [],[],[]
     
     onevision = re.search('(?P<url>http://onevision\.ucoz\.ua/[^<]+)', data, re.IGNORECASE)
     if onevision:
         onevision_data = util.substr(util.request(onevision.group('url')),'<td class=\"eText\"','<td class=\"rightColumn\"')
         onevision_resolved=resolver.findstreams(onevision_data, ['<embed( )src=\"(?P<url>[^\"]+)',
                                               '<object(.+?)data=\"(?P<url>[^\"]+)',
                                               '<iframe(.+?)src=[\"\'](?P<url>.+?)[\'\"]',
                                               '<object.*?data=(?P<url>.+?)</object>'])
     
     visionone = re.search('(?P<url>http://visionone\.ucoz\.ru/[^<]+)', data, re.IGNORECASE)
     if visionone:
         visionone_data = util.substr(util.request(visionone.group('url')),'<td class=\"eText\"','<td class=\"rightColumn\"')
         visionone_resolved = resolver.findstreams(visionone_data, ['<embed( )src=\"(?P<url>[^\"]+)',
                                               '<object(.+?)data=\"(?P<url>[^\"]+)',
                                               '<iframe(.+?)src=[\"\'](?P<url>.+?)[\'\"]',
                                               '<object.*?data=(?P<url>.+?)</object>'])
     scz = re.search('(?P<url>http://scz\.uvadi\.cz/\?p=[\d]+)', data, re.IGNORECASE)
     if scz:
         scz_data = util.substr(util.request(scz.group('url')),'<div id=\"content\"', '#content')
         scz_resolved = resolver.findstreams(scz_data, ['<embed( )src=\"(?P<url>[^\"]+)',
                                               '<object(.+?)data=\"(?P<url>[^\"]+)',
                                               '<iframe(.+?)src=[\"\'](?P<url>.+?)[\'\"]',
                                               '<object.*?data=(?P<url>.+?)</object>'])
         
     serialy_resolved = resolver.findstreams(data, ['<embed( )src=\"(?P<url>[^\"]+)',
                                            '<object(.+?)data=\"(?P<url>[^\"]+)',
                                            '<iframe(.+?)src=[\"\'](?P<url>.+?)[\'\"]',
                                            '<object.*?data=(?P<url>.+?)</object>',
                                            '<p><code><strong>(?P<url>http.+?)</strong></code></p>',
                                            '<p><code><strong><big>(?P<url>.+?)</big></strong></code></p>'])
     
     resolved = []
     resolved+= serialy_resolved or []
     resolved+= visionone_resolved or []
     resolved+= onevision_resolved or []
     resolved+= scz_resolved or []
     resolved = len(resolved) > 0 and resolved or None
     
     result = []
     for i in resolved:
         item = self.video_item()
         item['title'] = i['name']
         item['url'] = i['url']
         item['quality'] = i['quality']
         item['surl'] = i['surl']
         item['headers'] = i['headers']
         result.append(item) 
     if len(result) == 1:
         return result[0]
     elif len(result) > 1 and select_cb:
         return select_cb(result)
开发者ID:skata890,项目名称:xbmc-doplnky,代码行数:56,代码来源:serialy.py


示例19: list

 def list(self,url):
     if url.find('#fm#') == 0:
         return self.list_folder(url[5:])
     url = self._url(url)
     page = util.request(url,headers={'X-Requested-With':'XMLHttpRequest','Referer':url,'Cookie':'uloz-to-id=1561277170;'})
     script = util.substr(page,'var kn','</script>')
     keymap = None
     key = None
     k = re.search('{([^\;]+)"',script,re.IGNORECASE | re.DOTALL)
     if k:
         keymap = json.loads("{"+k.group(1)+"\"}")
     j = re.search('kapp\(kn\[\"([^\"]+)"',script,re.IGNORECASE | re.DOTALL)
     if j:
         key = j.group(1)
     if not (j and k):
         self.error('error parsing page - unable to locate keys')
         return []
     burl = b64decode('I2h0dHA6Ly9jcnlwdG8uamV6em92by5uZXQvZGVjcnlwdC8/a2V5PSVzJnZhbHVlPSVzCg==')
     murl = b64decode('aHR0cDovL2NyeXB0by5qZXp6b3ZvLm5ldC9kZWNyeXB0Lwo=')
     murl = 'http://crypto.jezzovo.net/decrypt/'
     data = util.substr(page,'<ul class=\"chessFiles','</ul>') 
     result = []
     req = {'seed':keymap[key],'values':keymap}
     decr = json.loads(util.post_json(murl,req))
     for li in re.finditer('<li data-icon=\"(?P<key>[^\"]+)',data, re.IGNORECASE |  re.DOTALL):
         body = urllib.unquote(b64decode(decr[li.group('key')]))
         m = re.search('<li>.+?<div data-icon=\"(?P<key>[^\"]+)[^<]+<img(.+?)src=\"(?P<logo>[^\"]+)(.+?)<div class=\"fileInfo(?P<info>.+?)</h4>',body, re.IGNORECASE |  re.DOTALL)
         if not m:
             continue
         value = keymap[m.group('key')]
         info = m.group('info')
         iurl = burl % (keymap[key],value)
         item = self.video_item()
         item['title'] = '.. title not found..'
         title = re.search('<div class=\"fileName.+?<a[^>]+>(?P<title>[^<]+)',info, re.IGNORECASE|re.DOTALL)
         if title:
             item['title'] = title.group('title')
         size = re.search('<span class=\"fileSize[^>]+>(?P<size>[^<]+)',info, re.IGNORECASE|re.DOTALL)
         if size:
             item['size'] = size.group('size').strip()
         time = re.search('<span class=\"fileTime[^>]+>(?P<time>[^<]+)',info, re.IGNORECASE|re.DOTALL)
         if time:
             item['length'] = time.group('time')
         item['url'] = iurl
         item['img'] = m.group('logo')
         self._filter(result,item)
     # page navigation
     data = util.substr(page,'<div class=\"paginator','</div')
     mnext = re.search('<a href=\"(?P<url>[^\"]+)\" class="next',data)
     if mnext:
         item = self.dir_item()
         item['type'] = 'next'
         item['url'] = mnext.group('url')
         result.append(item)
     return result
开发者ID:mx3L,项目名称:xbmc-doplnky,代码行数:55,代码来源:ulozto.py


示例20: resolve

 def resolve(self,item,captcha_cb=None,select_cb=None):
     item = item.copy()
     url = self._url(item['url']).replace('×', '%c3%97')
     data = util.substr(util.request(url), '<div id=\"content\"', '#content')
     
     for script in re.finditer('<script.+?src=\"([^\"]+)',data,re.IGNORECASE|re.DOTALL):
         try:
             data += util.request(script.group(1)).replace('\\\"','\"')
         except:
             pass
     util.init_urllib() # need to reinitialize urrlib, because anyfiles could have left some cookies 
     visionone_resolved, onevision_resolved, scz_resolved = [],[],[]
     
     onevision = re.search('(?P<url>http://onevision\.ucoz\.ua/[^<]+)', data, re.IGNORECASE)
     if onevision:
         onevision_data = util.substr(util.request(onevision.group('url')),'<td class=\"eText\"','<td class=\"rightColumn\"')
         onevision_resolved=self.findstreams(onevision_data, ['<embed( )src=\"(?P<url>[^\"]+)',
                                               '<object(.+?)data=\"(?P<url>[^\"]+)',
                                               '<iframe(.+?)src=[\"\'](?P<url>.+?)[\'\"]',
                                               '<object.*?data=(?P<url>.+?)</object>'])
     
     visionone = re.search('(?P<url>http://visionone\.ucoz\.ru/[^<]+)', data, re.IGNORECASE)
     if visionone:
         visionone_data = util.substr(util.request(visionone.group('url')),'<td class=\"eText\"','<td class=\"rightColumn\"')
         visionone_resolved = self.findstreams(visionone_data, ['<embed( )src=\"(?P<url>[^\"]+)',
                                               '<object(.+?)data=\"(?P<url>[^\"]+)',
                                               '<iframe(.+?)src=[\"\'](?P<url>.+?)[\'\"]',
                                               '<object.*?data=(?P<url>.+?)</object>'])
     scz = re.search('(?P<url>http://scz\.uvadi\.cz/\?p=[\d]+)', data, re.IGNORECASE)
     if scz:
         scz_data = util.substr(util.request(scz.group('url')),'<div id=\"content\"', '#content')
         scz_resolved = self.findstreams(scz_data, ['<embed( )src=\"(?P<url>[^\"]+)',
                                               '<object(.+?)data=\"(?P<url>[^\"]+)',
                                               '<iframe(.+?)src=[\"\'](?P<url>.+?)[\'\"]',
                                               '<object.*?data=(?P<url>.+?)</object>'])
         
     serialy_resolved = self.findstreams(data, ['<embed( )src=\"(?P<url>[^\"]+)',
                                            '<object(.+?)data=\"(?P<url>[^\"]+)',
                                            '<iframe(.+?)src=[\"\'](?P<url>.+?)[\'\"]',
                                            '< 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python util.svdata函数代码示例发布时间:2022-05-26
下一篇:
Python util.subp函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap