예제 #1
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
예제 #2
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
예제 #3
0
def _extract_list(doc):
  rtree = select_all(doc, 'tr.forum_header_border[name="hover"]')
  results = []
  for l in rtree:
    el = select_one(l, 'a.epinfo')
    title = get_text(el)
    img = '/img/icons/film.svg'
    el = select_one(l, 'a.magnet')
    url = get_attr(el, 'href')
    if url is None:
      continue
    subs = series_season_episode(title)
    tds = select_all(l, 'td')
    seeds = get_text(select_one(tds[-1], 'font'))
    if not seeds:
      seeds = '0'
    released = get_text(tds[-2])
    size = get_text(tds[-3])
    if not size:
      size = 'NA'
    result = {}
    result['title'] = title
    result['img'] = img
    result['url'] = url
    result['subs'] = subs
    result['seeds'] = seeds
    result['released'] = released
    result['size'] = size
    results.append(result)
  return results
예제 #4
0
def _extract_popular(doc):
    rtree = select_all(doc, 'li.most-popular__item')
    results = PlayItemList()

    for l in rtree:
        a = select_one(l, 'a')
        url = get_attr(a, 'href')
        if url is None:
            continue
        if url.startswith('/iplayer'):
            url = "http://www.bbc.co.uk" + url
        idiv = select_one(l, 'div.rs-image')
        idiv = select_one(idiv, 'source')
        img = get_attr(idiv, 'srcset')
        img = img.split()[0]

        idiv = select_one(l, 'div.content-item__info__text')
        title = get_text(select_one(idiv, 'div.content-item__title'))
        pdiv = select_one(idiv, 'div.content-item__info__primary')
        subtitle = get_text(select_one(pdiv, 'div.content-item__description'))
        pdiv = select_one(idiv, 'div.content-item__info__secondary')
        synopsis = get_text(select_one(pdiv, 'div.content-item__description'))
        item = PlayItem(title, img, url, subtitle, synopsis)
        results.add(item)
    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):
    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
예제 #7
0
def _extract(doc):
    rtree = select_all(doc, 'li.browse-content-item-videos')
    results = PlayItemList()
    for l in rtree:
        el = select_one(l, 'a')
        href = get_attr(el, 'href')
        if href is None:
            continue
        url = _PREFIX + href
        el = select_one(l, 'img')
        img = get_attr(el, 'src')
        el = select_one(l, 'div.browse-content-top-line')
        subtitle = get_text(el)
        el = select_one(l, 'div.browse-content-second-line')
        title = get_text(el)
        results.add(PlayItem(title, img, url, subtitle))
    return results

    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
예제 #8
0
def _extract_grid(doc):
    rtree = select_all(doc, 'li.grid__item')
    results = PlayItemList()
    for l in rtree:
        a = select_one(l, 'a')
        url = get_attr(a, 'href')
        if url is None:
            continue
        if url.startswith('/iplayer'):
            url = "http://www.bbc.co.uk" + url
        idiv = select_one(l, 'div.rs-image')
        idiv = select_one(idiv, 'img')
        img = get_attr(idiv, 'srcset').split()[0]

        sdiv = select_one(l, 'div.content-item__info__text')
        avail = select_one(sdiv, 'div.content-item__labels')
        if get_text_content(avail) == "Not available":
            continue

        title = get_text_content(select_one(sdiv, 'div.content-item__title'))
        subtitle = get_text_content(
            select_one(sdiv, 'div.content-item__description'))
        if title.endswith("..."):
            title = title[:-3]
        if subtitle.endswith("..."):
            subtitle = subtitle[:-3]

        item = PlayItem(title, img, url, subtitle)
        a = select_one(l, 'a.js-view-all-episodes')
        if a is not None:
            link = "http://bbc.co.uk" + a.get('href')
            item.add_action(MoreEpisodesAction(link, title))
        results.add(item)
    return results
예제 #9
0
def _extract(doc):
  rtree = select_all(doc, 'li.browse-content-item-videos')
  results = PlayItemList()
  for l in rtree:
    el = select_one(l, 'a')
    href = get_attr(el, 'href')
    if href is None:
      continue
    url = _PREFIX + href
    el = select_one(l, 'img')
    img = get_attr(el, 'src')
    el = select_one(l, 'div.browse-content-top-line')
    subtitle = get_text(el)
    el = select_one(l, 'div.browse-content-second-line')
    title = get_text(el)
    results.add(PlayItem(title, img, url, subtitle))
  return results

  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
예제 #10
0
def _extract(doc):
    rtree = select_all(doc, 'li.list-item')
    results = PlayItemList()
    for l in rtree:
        a = select_one(l, 'a')
        url = get_attr(a, 'href')
        if url is None:
            continue
        if url.startswith('/iplayer'):
            url = "http://www.bbc.co.uk" + url

        pdiv = select_one(l, 'div.primary')
        idiv = select_one(pdiv, 'div.r-image')
        if idiv is None:
            idiv = select_one(pdiv, 'div.rs-image')
            idiv = select_one(idiv, 'source')
            img = get_attr(idiv, 'srcset')
        else:
            img = get_attr(idiv, 'data-ip-src')

        sdiv = select_one(l, 'div.secondary')
        title = get_text(select_one(sdiv, 'div.title'))
        subtitle = get_text(select_one(sdiv, 'div.subtitle'))
        synopsis = get_text(select_one(sdiv, 'p.synopsis'))
        item = PlayItem(title, img, url, subtitle, synopsis)
        a = select_one(l, 'a.view-more-container')
        if a is not None:
            link = "http://bbc.co.uk" + a.get('href')
            item.add_action(MoreEpisodesAction(link, title))
        results.add(item)
    return results
예제 #11
0
def _extract(doc):
  rtree = select_all(doc, 'li.list-item')
  results = PlayItemList()
  for l in rtree:
    a = select_one(l, 'a')
    url = get_attr(a, 'href')
    if url is None or not url.startswith('/iplayer'):
      continue
    url = "http://www.bbc.co.uk" + url

    pdiv = select_one(l, 'div.primary')
    idiv = select_one(pdiv, 'div.r-image')
    img = get_attr(idiv, 'data-ip-src')

    sdiv = select_one(l, 'div.secondary')
    title = get_text(select_one(sdiv, 'div.title'))
    subtitle = get_text(select_one(sdiv, 'div.subtitle'))
    synopsis = get_text(select_one(sdiv, 'p.synopsis'))
    item = PlayItem(title, img, url, subtitle, synopsis)
    a = select_one(l, 'a.view-more-container')
    if a is not None:
      link = "http://bbc.co.uk" + a.get('href')
      item.add_action(MoreEpisodesAction(link, title))
    results.add(item)
  return results
예제 #12
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
예제 #13
0
def _extract_showlist(doc):
  rtree = select_all(doc, 'tr[name="hover"]')
  img = None
  results = PlayItemList()
  for l in rtree:
    el = select_one(l, 'a.thread_link')
    title = get_text(el)
    url = get_attr(el, 'href')
    el = select_one(l, 'b')
    rating = get_text(el)
    subtitle = "Rating: " + rating
    item = ShowMoreItem(title, img, url, subtitle)
    results.add(item)
  return results
예제 #14
0
def _extract(doc):
    results = PlayItemList()
    rtree = select_all(doc, 'tr')
    first = True
    for l in rtree:
        if first:
            first = False
            continue
        el = select_one(l, "a[title='More from this category']")
        maincat = get_text(el)
        img = '/img/icons/film.svg'
        if maincat is not None:
            if maincat == 'Video':
                img = '/img/icons/film.svg'
            elif maincat == 'Audio':
                img = '/img/icons/music.svg'
            else:
                continue
        el = select_one(l, 'a.detLink')
        title = get_text(el)
        el = select_one(l, "a[title='Download this torrent using magnet']")
        url = get_attr(el, 'href')
        el = select_one(l, 'font.detDesc')
        desc = get_text(el)
        start = desc.find(', Size ')
        if start == -1:
            continue
        start = start + 7
        end = desc.find(',', start)
        if end == -1:
            continue
        size = desc[start:end].replace("iB", "B")
        el = select_one(l, "td:nth-child(3)")
        seeds = get_text(el)
        el = select_one(l, "td:nth-child(4)")
        peers = get_text(el)
        subtitle = chanutils.torrent.subtitle(size, seeds, peers)
        subcat = "Movies"
        el = select_one(l, ":nth-child(3)")
        if el.text is not None:
            subcat = get_text(el)
        subs = None
        if subcat.endswith("Movies"):
            subs = movie_title_year(title)
        elif subcat.endswith("shows"):
            subs = series_season_episode(title)
        if not url:
            continue
        results.add(TorrentPlayItem(title, img, url, subtitle, subs=subs))
    return results
예제 #15
0
def _extract(doc):
    results = PlayItemList()
    rtree = select_all(doc, 'div.col')
    for r in rtree:
        el = select_one(r, "h4")
        title = get_text(el)
        if not title:
            continue
        el = select_one(r, "img")
        img = get_attr(el, "src")
        el = select_one(r, "a.js-click-video")
        url = get_attr(el, "href")
        results.add(PlayItem(title, img, url))
    return results
예제 #16
0
def _extract(doc):
  rtree = select_all(doc, '#browse_content li a')
  results = PlayItemList()
  for l in rtree:
    url = _PREFIX + l.get('href')
    title = get_attr(l, 'title')
    if title is None:
      break
    el = select_one(l, 'img')
    img = get_attr(el, 'src')
    el = select_one(l, 'time')
    subtitle = get_text(el)
    results.add(PlayItem(title, img, url, subtitle))
  return results
예제 #17
0
def _extract(doc):
    rtree = select_all(doc, '#browse_content li a')
    results = PlayItemList()
    for l in rtree:
        url = _PREFIX + l.get('href')
        title = get_attr(l, 'title')
        if title is None:
            break
        el = select_one(l, 'img')
        img = get_attr(el, 'src')
        el = select_one(l, 'time')
        subtitle = get_text(el)
        results.add(PlayItem(title, img, url, subtitle))
    return results
예제 #18
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
예제 #19
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
예제 #20
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
예제 #21
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
예제 #22
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
예제 #23
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
예제 #24
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
예제 #25
0
def _extract_list(doc):
    rtree = select_all(doc, 'tr')
    results = []
    for l in rtree:
        el = select_one(l, 'a.torrents_table__torrent_title > b')
        # tr is not a result
        if el is None:
            continue
        title = get_text(el)
        el = select_one(l, 'a[title="Torrent magnet link"]')
        # DMCA takedown
        if el is None:
            continue
        url = get_attr(el, 'href')
        img = '/img/icons/film.svg'
        el = select_one(
            l, 'span.torrents_table__upload_info > a.text--muted > strong')
        cat = get_text(el)
        if not (cat in _CAT_WHITELIST):
            continue
        if cat.endswith('Music'):
            img = '/img/icons/music.svg'
        subs = None
        if cat == 'Movies':
            subs = movie_title_year(title)
        elif cat == 'TV':
            subs = series_season_episode(title)
        el = select_one(l, 'td[data-title="Size"]')
        size = get_text_content(el)
        el = select_one(l, 'td[data-title="Seed"]')
        seeds = get_text(el)
        el = select_one(l, 'td[data-title="Leech"]')
        peers = get_text(el)
        result = {}
        result['title'] = title
        result['url'] = url
        result['img'] = img
        result['subs'] = subs
        result['size'] = size
        result['seeds'] = seeds
        result['peers'] = peers
        results.append(result)
    return results
예제 #26
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
예제 #27
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
예제 #28
0
def _extract(doc):
    rtree = select_all(doc, 'div.thumb-block')
    results = PlayItemList()
    for l in rtree:
        ti = select_one(l, 'div.thumb-inside')
        ael = select_one(ti, 'a')
        url = _ROOT_URL + get_attr(ael, 'href')
        imgel = select_one(ael, 'img')
        img = get_attr(imgel, 'data-src')
        img = img.replace('THUMBNUM', '2')
        tu = select_one(l, 'div.thumb-under')
        el = select_one(tu, 'a')
        title = get_text(el)
        el = select_one(tu, 'p.metadata')
        lxml.etree.strip_tags(el, '*')
        strings = el.text.replace('\n', ' ').split(' ')
        strings = [x for x in strings if x.strip()]
        if len(strings) == 2:
            size = strings[0]
            rating = "NA"
            duration = strings[1]
        elif len(strings) == 3:
            size = strings[0]
            rating = strings[1]
            duration = strings[2]
        elif len(strings) == 4:
            size = strings[0]
            rating = strings[1]
            duration = strings[2] + " " + strings[3]
        subtitle = _subtitle({
            'Duration': duration,
            'Size': size,
            'Rating': rating
        })
        results.add(PlayItem(title, img, url, subtitle))
    return results
예제 #29
0
def _extract_grid(idx, doc):
    rtree = select_all(doc, 'li.grid__item')
    results = PlayItemList()

    count = 0
    for l in rtree:
        a = select_one(l, 'a')
        url = get_attr(a, 'href')
        if url is None:
            continue
        if url.startswith('/iplayer'):
            url = "http://www.bbc.co.uk" + url
        idiv = select_one(l, 'div.rs-image')
        idiv = select_one(idiv, 'source')
        img = get_attr(idiv, 'srcset').split()[0]

        sdiv = select_one(l, 'div.content-item__info__text')
        avail = select_one(sdiv, 'div.content-item__labels')
        if get_text_content(avail) == "Not available":
            continue

        title = get_text_content(select_one(sdiv, 'div.content-item__title'))
        subtitle = get_text_content(
            select_one(sdiv, 'div.content-item__description'))
        if title.endswith("..."):
            title = title[:-3]
        if subtitle.endswith("..."):
            subtitle = subtitle[:-3]

        item = PlayItem(title, img, url, subtitle)
        a = select_one(l, 'a.js-view-all-episodes')
        if a is not None:
            link = "http://bbc.co.uk" + a.get('href')
            item.add_action(MoreEpisodesAction(link, title))

        if count == 0:
            seriestree = select_all(doc, 'li.scrollable-nav__item')
            for st in seriestree:
                a = select_one(st, 'a')
                url = get_attr(a, 'href')
                if url is None:
                    continue
                if url.startswith('/iplayer'):
                    url = "http://www.bbc.co.uk" + url
                sdiv = select_one(st, 'span.button__text')
                title = get_text_content(sdiv)
                if title is None:
                    continue
                item.add_action(MoreEpisodesAction(url, title))
        count = count + 1
        results.add(item)

    if idx is not None:
        if idx == 1:
            item1 = PlayItem(
                "BBC One",
                "https://static.bbci.co.uk/tviplayer/img/navigation/bbcone.svg",
                "https://a.files.bbci.co.uk/media/live/manifesto/audio_video/simulcast/hls/uk/hls_mobile_wifi_rw/aks/bbc_one_london.m3u8",
                "BBC One Live", "Watch Live TV")
            results.add(item1)
        elif idx == 2:
            item2 = PlayItem(
                "BBC Two",
                "https://static.bbci.co.uk/tviplayer/img/navigation/bbctwo.svg",
                "https://a.files.bbci.co.uk/media/live/manifesto/audio_video/simulcast/hls/uk/hls_mobile_wifi_rw/llnws/bbc_two_england.m3u8",
                "BBC Two Live", "Watch Live TV")
            results.add(item2)
        elif idx == 4:
            #item3 = PlayItem("BBC Three", "https://static.bbci.co.uk/tviplayer/img/navigation/bbcfour.svg", "https://a.files.bbci.co.uk/media/live/manifesto/audio_video/simulcast/hls/uk/hls_mobile_wifi_rw/llnws/bbc_four.m3u8", "BBC Four Live", "Watch Live TV")
            #results.add(item3)
            item4 = PlayItem(
                "BBC Four",
                "https://static.bbci.co.uk/tviplayer/img/navigation/bbcfour.svg",
                "https://a.files.bbci.co.uk/media/live/manifesto/audio_video/simulcast/hls/uk/hls_mobile_wifi_rw/llnws/bbc_four.m3u8",
                "BBC Four Live", "Watch Live TV")
            results.add(item4)
        elif idx == 17:
            item5 = PlayItem(
                "BBC News",
                "https://static.bbci.co.uk/tviplayer/img/navigation/bbcnews.svg",
                "https://a.files.bbci.co.uk/media/live/manifesto/audio_video/simulcast/hls/uk/hls_mobile_wifi_rw/aks/bbc_news24.m3u8",
                "BBC News Live", "Watch Live TV")
            results.add(item5)

    return results