コード例 #1
0
ファイル: feed.py プロジェクト: stephenjudge/vidscraper
            description = entry.get("summary", "")

        embed_code = None
        if "media_player" in entry:
            player = entry["media_player"]
            if player.get("content"):
                embed_code = convert_entities(player["content"])
            elif "url" in player:
                embed_code = make_embed_code(player["url"], "")
        if "media_license" in entry:
            license = entry["media_license"]["href"]
        else:
            license = entry.get("license")
        return {
            "link": link,
            "title": convert_entities(entry["title"]),
            "description": description,
            "thumbnail_url": get_entry_thumbnail_url(entry),
            "file_url": enclosure.get("url") if enclosure else None,
            "file_url_mimetype": enclosure.get("type") if enclosure else None,
            "file_url_length": ((enclosure.get("filesize") or enclosure.get("length")) if enclosure else None),
            "publish_datetime": best_date,
            "guid": entry.get("id"),
            "embed_code": embed_code,
            "tags": [tag["term"] for tag in entry["tags"] if tag["scheme"] is None] if "tags" in entry else None,
            "license": license,
        }


registry.register_fallback(GenericFeedSuite)
コード例 #2
0
ファイル: generic.py プロジェクト: afrigeo/vidscraper
            elif 'url' in player:
                files.append(VideoFile(
                                     url=player['url'],
                                     mime_type=player.get('type')))
        if not files:
            files = None
        if 'media_license' in item:
            license = item['media_license']['href']
        else:
            license = item.get('license')
        return {
            'link': link,
            'title': convert_entities(item.get('title', '')),
            'description': description,
            'thumbnail_url': get_entry_thumbnail_url(item),
            'files': files,
            'publish_datetime': best_date,
            'guid': item.get('id'),
            'embed_code': embed_code,
            'tags': [tag['term'] for tag in item['tags']
                     if tag['scheme'] is None] if 'tags' in item else None,
            'license': license
        }


class Suite(BaseSuite):
    feed_class = Feed


registry.register_fallback(Suite)
コード例 #3
0
        return {
            'link':
            link,
            'title':
            convert_entities(item.get('title', '')),
            'description':
            description,
            'thumbnail_url':
            get_entry_thumbnail_url(item),
            'files':
            files,
            'publish_datetime':
            best_date,
            'guid':
            item.get('id'),
            'embed_code':
            embed_code,
            'tags':
            [tag['term'] for tag in item['tags']
             if tag['scheme'] is None] if 'tags' in item else None,
            'license':
            license
        }


class Suite(BaseSuite):
    feed_class = Feed


registry.register_fallback(Suite)