Slixfeed/slixfeed/feedhandler.py
2023-10-24 14:43:14 +00:00

18 lines
No EOL
356 B
Python

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from urllib.parse import urlparse
async def get_title(url, feed):
"""
Get title of feed.
:param url: URL
:param feed: Parsed feed
:return: Title or URL hostname.
"""
try:
title = feed["feed"]["title"]
except:
title = urlparse(url).netloc
return title