示例#1
0
def search(q):
    session = new_session()
    doc = get_doc(_SEARCH_URL + q, session=session)
    title = get_text(select_one(doc, 'head > title'))
    if title.startswith('Cookies - '):
        doc = get_doc(_SEARCH_URL + q, session=session)
    return _extract_sort(doc)
示例#2
0
def feed(idx):
    url = _FEEDLIST[idx]['url']
    if url.endswith('.json'):
        return chanutils.reddit.get_feed(_FEEDLIST[idx])
    else:
        doc = get_doc(url)
        return _extract(doc)
示例#3
0
def feed(idx):
  url = _FEEDLIST[idx]['url']
  if url.endswith('.json'):
    return chanutils.reddit.get_feed(_FEEDLIST[idx])
  else:
    doc = get_doc(url)
    return _extract(doc)
示例#4
0
def feed(idx):
  url = _FEEDLIST[idx]['url']
  doc = get_doc(url)
  rtree = select_all(doc, "a.complex-link")
  results = PlayItemList()
  for l in rtree:
    url = get_attr(l, 'href')
    el = select_one(l, '.tout__title')
    if el is None:
      continue
    title = get_text(el)
    el = select_one(l, 'img.fluid-media__media')
    img = get_attr(el, 'src')
    el = select_one(l, 'p.tout__meta')
    subtitle = get_text_content(el)
    if subtitle == 'No episodes available':
      continue    
    item = PlayItem(title, img, url, subtitle)
    if subtitle != '1 episode':
      item.add_action(MoreEpisodesAction(url, title))
    results.add(item)
  if idx == 0:
    global _SHOWLIST
    _SHOWLIST = results
  return results
示例#5
0
def feed(idx):
    url = _FEEDLIST[idx]['url']
    doc = get_doc(url)
    rtree = select_all(doc, "a.complex-link")
    results = PlayItemList()
    for l in rtree:
        url = get_attr(l, 'href')
        el = select_one(l, '.tout__title')
        if el is None:
            continue
        title = get_text(el)
        el = select_one(l, 'img.fluid-media__media')
        img = get_attr(el, 'src')
        el = select_one(l, 'p.tout__meta')
        subtitle = get_text_content(el)
        if subtitle == 'No episodes available':
            continue
        item = PlayItem(title, img, url, subtitle)
        if subtitle != '1 episode':
            item.add_action(MoreEpisodesAction(url, title))
        results.add(item)
    if idx == 0:
        global _SHOWLIST
        _SHOWLIST = results
    return results
示例#6
0
def feed(idx):
    doc = get_doc(_FEEDLIST[idx]['url'])
    if idx == 0:
        return _extract_grid(idx, doc)
        #return _extract_popular(doc)
    else:
        return _extract_grid(idx, doc)
示例#7
0
def search(q):
  q = q.replace(' ', '-')
  q = q.replace("'", '')
  doc = get_doc(_SEARCH_URL + q)
  rtree = select_all(doc, 'div.search-wrapper')
  results = PlayItemList()
  for l in rtree:
    el = select_one(l, 'div.remaining-time')
    if el is not None and get_text(el).strip() == 'unavailable':
      continue
    el = select_one(l, 'h4 a')
    url = get_attr(el, 'href')
    title = get_text(el)
    el = select_one(l, "div.search-result-image a img")
    img = get_attr(el, 'src')
    el = select_one(l, ".search-episode-count")
    matched = int(get_attr(el, 'data-matched_episodes'))
    episodes = get_text(el)
    episodes = int(episodes[0:episodes.find(' ')])
    action = None
    if episodes > matched:
      action = MoreEpisodesAction(url, title)
    eps = select_all(l, ".episode")
    for e in eps:
      el = select_one(e, ".episode-title a")
      url = _PREFIX + get_attr(el, 'href')
      subtitle = get_text(el)
      el = select_one(e, ".description")
      synopsis = get_text_content(el)
      item = PlayItem(title, img, url, subtitle, synopsis)
      results.add(item)
      if action:
        item.add_action(action)
        break
  return results
示例#8
0
def search(q):
    q = q.replace(' ', '-')
    q = q.replace("'", '')
    doc = get_doc(_SEARCH_URL + q)
    rtree = select_all(doc, 'div.search-wrapper')
    results = PlayItemList()
    for l in rtree:
        el = select_one(l, 'h4 a')
        url = get_attr(el, 'href')
        title = get_text(el)
        el = select_one(l, "div.search-result-image a img")
        img = get_attr(el, 'src')
        el = select_one(l, ".search-episode-count")
        matched = int(get_attr(el, 'data-matched_episodes'))
        episodes = get_text(el)
        episodes = int(episodes[0:episodes.find(' ')])
        action = None
        if episodes > matched:
            action = MoreEpisodesAction(url, title)
        eps = select_all(l, ".episode")
        for e in eps:
            el = select_one(e, ".episode-title a")
            url = _PREFIX + get_attr(el, 'href')
            subtitle = get_text(el)
            el = select_one(e, ".description")
            synopsis = get_text_content(el)
            item = PlayItem(title, img, url, subtitle, synopsis)
            results.add(item)
            if action:
                item.add_action(action)
                break
    return results
示例#9
0
def download_sbs(video_link):
    doc = get_doc(video_link)
    player_params = get_player_params(doc)
    release_url = player_params["releaseUrls"]["html"]

    doc = get_xml(release_url)
    video = doc.xpath("//smil:video", namespaces=NS)[0]
    video_url = video.attrib["src"]
    if not video_url:
        raise Exception("Unsupported video : %s" % (video_link))
    return video_url
示例#10
0
def feed(idx):
  doc = get_doc(_FEEDLIST[idx]['url'])
  rtree = select_all(doc, 'div.post-block')
  results = PlayItemList()
  for l in rtree:
    el = select_one(l, 'a')
    url = get_attr(el, 'href')
    el = select_one(l, 'img')
    img = get_attr(el, 'src')
    el = select_one(l, 'div.post-block__content')
    subtitle = get_text(el)
    el = select_one(l, 'a.post-block__title__link')
    title = get_text(el)
    results.add(PlayItem(title, img, url, subtitle))
  return results
示例#11
0
def feed(idx):
  doc = get_doc(_FEEDLIST[idx]['url'])
  rtree = select_all(doc, 'div.thumbs li')
  results = PlayItemList()
  for l in rtree:
    el = select_one(l, 'a')
    url = get_attr(el, 'href')
    el = select_one(l, 'img')
    img = get_attr(el, 'src')
    el = select_one(l, 'h4.talk-link__speaker')
    subtitle = get_text(el)
    el = select_one(l, 'a span')
    title = get_text(el)
    results.add(PlayItem(title, img, url, subtitle))
  return results
示例#12
0
def search(q):
    doc = get_doc(_SEARCH_URL, params={'q': q})
    rtree = select_all(doc, 'article.search__result')
    results = PlayItemList()
    for l in rtree:
        el = select_one(l, 'a')
        url = get_attr(el, 'href')
        if not url.startswith('/talks/'):
            continue
        url = _PREFIX + url
        title = get_text(el)
        el = select_one(l, 'img')
        img = get_attr(el, 'src')
        el = select_one(l, 'div.search__result__description')
        synopsis = get_text(el)
        results.add(PlayItem(title, img, url, synopsis=synopsis))
    return results
示例#13
0
def showmore(link):
  doc = get_doc(link)
  rtree = select_all(doc, "a.complex-link")
  results = PlayItemList()
  for l in rtree:
    url = get_attr(l, 'href')
    el = select_one(l, 'img.fluid-media__media')
    img = get_attr(el, 'src')
    el = select_one(l, 'h3')
    title = get_text(el)
    el = select_one(l, 'time')
    subtitle = get_text(el)
    el = select_one(l, 'p.tout__summary')
    synopsis = get_text(el)
    item = PlayItem(title, img, url, subtitle, synopsis)
    results.add(item)
  return results
示例#14
0
def showmore(link):
    doc = get_doc(link)
    rtree = select_all(doc, "a.complex-link")
    results = PlayItemList()
    for l in rtree:
        url = get_attr(l, 'href')
        el = select_one(l, 'img.fluid-media__media')
        img = get_attr(el, 'src')
        el = select_one(l, 'h3')
        title = get_text(el)
        el = select_one(l, 'time')
        subtitle = get_text(el)
        el = select_one(l, 'p.tout__summary')
        synopsis = get_text(el)
        item = PlayItem(title, img, url, subtitle, synopsis)
        results.add(item)
    return results
示例#15
0
def feed(idx):
    url = _FEEDLIST[idx]['url']
    doc = get_doc(url)
    rtree = select_all(doc, 'li.programme')
    results = PlayItemList()
    for l in rtree:
        el = select_one(l, '.programme-title a')
        url = _PREFIX + get_attr(el, 'href')
        title = get_text(el)
        el = select_one(l, 'img')
        img = get_attr(el, 'src')
        subtitle = get_text(select_one(l, '.episode-info span.episode-free'))
        item = PlayItem(title, img, url, subtitle)
        if (subtitle is not None) and (not subtitle.startswith('1 ')):
            item.add_action(MoreEpisodesAction(url, title))
        results.add(item)
    return results
示例#16
0
def feed(idx):
  url = _FEEDLIST[idx]['url']
  doc = get_doc(url)
  rtree = select_all(doc, 'li.programme')
  results = PlayItemList()
  for l in rtree:
    el = select_one(l, '.programme-title a')
    url = _PREFIX + get_attr(el, 'href')
    title = get_text(el)
    el = select_one(l, 'img')
    img = get_attr(el, 'src')
    subtitle = get_text(select_one(l, '.episode-info span.episode-free'))
    item = PlayItem(title, img, url, subtitle)
    if (subtitle is not None) and (not subtitle.startswith('1 ')):
      item.add_action(MoreEpisodesAction(url, title))
    results.add(item)
  return results
示例#17
0
def showmore(link):
    doc = get_doc(link)
    rtree = select_all(doc, 'div.views-row')
    results = PlayItemList()
    for l in rtree:
        el = select_one(l, 'a')
        url = _PREFIX + get_attr(el, 'href')
        el = select_one(el, 'img')
        img = get_attr(el, 'src')
        el = select_one(l, 'span.date-display-single')
        subtitle = get_text(el)
        el = select_one(l, 'div.field-season-number')
        title1 = get_text_content(el)
        el = select_one(l, 'div.field-episode-number')
        title = title1 + " " + get_text_content(el)
        el = select_one(l, 'div.field-name-field-short-synopsis')
        synopsis = get_text_content(el)
        item = PlayItem(title, img, url, subtitle, synopsis)
        results.add(item)
    return results
示例#18
0
def showmore(link):
  doc = get_doc(link)
  rtree = select_all(doc, 'div.views-row')
  results = PlayItemList()
  for l in rtree:
    el = select_one(l, 'a')
    url = _PREFIX + get_attr(el, 'href')
    el = select_one(el, 'img')
    img = get_attr(el, 'src')
    el = select_one(l, 'span.date-display-single')
    subtitle = get_text(el)
    el = select_one(l, 'div.field-season-number')
    title1 = get_text_content(el)
    el = select_one(l, 'div.field-episode-number')
    title = title1 + " " + get_text_content(el)
    el = select_one(l, 'div.field-name-field-short-synopsis')
    synopsis = get_text_content(el)
    item = PlayItem(title, img, url, subtitle, synopsis)
    results.add(item)
  return results
示例#19
0
def feed(idx):
  url = _FEEDLIST[idx]['url']
  doc = get_doc(url)
  
  livetree = select_all(doc, "div.genie-container")
  results = PlayItemList()
  
  for l in livetree:
    img = get_attr(l, "data-video-posterframe")
    title = get_attr(l, "data-video-channel-id")
    item = PlayItem(title.upper(), img, url, 'Watch LIVE TV')
    results.add(item)
  
  rtree = select_all(doc, "a.complex-link")
  for l in rtree:
    url = get_attr(l, 'href')
    el = select_one(l, '.tout__title')
    if el is None:
      el = select_one(l, '.slice__title')
      if el is None:
        continue
    title = get_text(el)
    el = select_one(l, 'img.fluid-media__media')
    img = get_attr(el, 'src')
    el = select_one(l, 'p.tout__summary')
    if el is None:
      el = select_one(l, 'p.tout__meta')
      if el is None:
        el = select_one(l, 'p.slice__meta')
    subtitle = get_text_content(el)
    if subtitle == 'No episodes available':
      continue    
    item = PlayItem(title, img, url, subtitle)
    if subtitle != '1 episode':
      item.add_action(MoreEpisodesAction(url, title))
    results.add(item)
    
      
  return results
示例#20
0
def showmore(link):
    doc = get_doc(link)
    return _extract_grid(doc)
示例#21
0
def search(q):
    doc = get_doc(_SEARCH_URL, params={'q': q})
    return _extract_grid(doc)
示例#22
0
def search(q):
  q = q.replace(' ', '-')
  doc = get_doc(_SEARCH_URL + q)
  return _extract_html(doc)
示例#23
0
def search(q):
    url = _SEARCH_URL % urllib.quote(q.encode('utf8'))
    doc = get_doc(url)
    return _extract(doc)
示例#24
0
def showmore(link):
  doc = get_doc(link)
  return _extract(doc)
示例#25
0
def search(q):
  doc = get_doc(_SEARCH_URL, params = { 'q':q })
  return _extract(doc)
示例#26
0
def showmore(link):
    print "show more => " + link
    doc = get_doc(link)
    return _extract_grid(1, doc)
示例#27
0
def showmore(show_url):
  doc = get_doc(_BASE_URL + show_url)
  return _extract_html(doc)
示例#28
0
def search(q):
    doc = get_doc(_SEARCH_URL + q)
    return _extract(doc)
示例#29
0
def feed(idx):
  doc = get_doc(_FEEDLIST[idx]['url'])
  if idx > 0:
    return _extract_showlist(doc)
  else:
    return _extract_html(doc)
示例#30
0
def feed(idx):
    doc = get_doc(_FEEDLIST[idx]['url'])
    return _extract(doc)
示例#31
0
def feed(idx):
  doc = get_doc(_FEEDLIST[idx]['url'])
  return _extract(doc)
示例#32
0
def search(q):
  doc = get_doc(_SEARCH_URL, params={'mySearch':q})
  if select_one(doc, 'li.search-no-videos-heading') is None:
    return _extract(doc)
  else:
    return PlayItemList()
示例#33
0
def search(q):
    doc = get_doc(_SEARCH_URL, params={'mySearch': q})
    if select_one(doc, 'li.search-no-videos-heading') is None:
        return _extract(doc)
    else:
        return PlayItemList()
示例#34
0
def search(q):
    doc = get_doc(_SEARCH_URL + '?q=' + quote(q))
    return _extract(doc)