Пример #1
0
def feed_import(request, text: T.str) -> FeedImportResultSchema:
    """从OPML/XML内容或含有链接的HTML或文本内容导入订阅"""
    with timer('Import-Feed-From-Text'):
        urls = import_feed_from_text(text)
    if len(urls) > 2000:
        return Response({"message": "订阅数超过限制"}, status=400)
    is_from_bookmark = len(urls) > 100
    return _create_feeds_by_urls(request.user, urls, is_from_bookmark=is_from_bookmark)
Пример #2
0
def feed_import(request, text: T.str) -> FeedImportResultSchema:
    """从OPML/XML内容或含有链接的HTML或文本内容导入订阅"""
    with timer('Import-Feed-From-Text'):
        urls = import_feed_from_text(text)
    is_from_bookmark = len(urls) > 100
    return _create_feeds_by_urls(request.user,
                                 urls,
                                 is_from_bookmark=is_from_bookmark)
Пример #3
0
def feed_import(request, text: T.str, group: T.str.optional) -> FeedImportResultSchema:
    """从OPML/XML内容或含有链接的HTML或文本内容导入订阅"""
    with timer('Import-Feed-From-Text'):
        import_feeds = import_feed_from_text(text)
    if len(import_feeds) > MAX_FEED_COUNT:
        return Response({"message": "订阅数超过限制"}, status=400)
    is_from_bookmark = len(import_feeds) > 100
    return _create_feeds_by_imports(
        request.user, import_feeds, group=group,
        is_from_bookmark=is_from_bookmark)