示例#1
0
def _extract(data):
    results = PlayItemList()
    if 'data' not in data:
        return results
    if 'movies' not in data['data']:
        return results
    rtree = data['data']['movies']
    for r in rtree:
        if 'torrents' not in r:
            continue
        torrent = _smallest_size(r['torrents'])
        title = r['title_long']
        img = r['medium_cover_image']
        # Proxy
        img = "https://img.yts.mx" + img[14:]
        url = torrent['url']
        size = torrent['size']
        seeds = torrent['seeds']
        peers = torrent['peers']
        subtitle = chanutils.torrent.subtitle(size, seeds, peers)
        rating = str(r['rating'])
        if rating[-1] == '0':
            rating = rating[:-1]
        imdb = "<a target='_blank' href='http://www.imdb.com/title/" + r[
            'imdb_code'] + "/'>IMDB Rating: " + rating + "</a>"
        synopsis = imdb
        subs = movie_title_year(title)
        subs['imdb'] = r['imdb_code']
        results.add(TorrentPlayItem(title, img, url, subtitle, synopsis, subs))
    return results
示例#2
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
示例#3
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
示例#4
0
def _extract(data, moviesubs):
  results = playitem.PlayItemList()
  if not 'data' in data or len(data['data']['children']) == 0:
    return results
  rtree = data['data']['children']
  for r in rtree:
    r = r['data']
    # Internal reddit question/discussion
    if r['is_self']:
      continue
    thumb = None
    if r['thumbnail'] and r['thumbnail'].find('/') > -1:
      thumb = r['thumbnail']
    subtitle = "Score: " + str(r['score'])
    comments = "<a target='_blank' href='http://reddit.com" + r['permalink'] + "'>Comments:" + str(r['num_comments']) + "</a>" 
    subtitle = subtitle + ", " + comments
    title = chanutils.replace_entity(r['title'])
    url = chanutils.replace_entity(r['url'])
    subs = None
    if moviesubs:
      subs = chanutils.movie_title_year(title)
    item = playitem.PlayItem(title, thumb, url, subtitle, subs=subs)
    results.add(item)
  return results