add some debug
This commit is contained in:
@@ -1,21 +1,25 @@
|
|||||||
import requests
|
import requests
|
||||||
import xmltodict
|
import xmltodict
|
||||||
import urllib.request
|
|
||||||
from urllib import request as urlrequest
|
from urllib import request as urlrequest
|
||||||
from urllib import parse as urlparse
|
|
||||||
|
|
||||||
from django.template.loader_tags import ExtendsNode
|
|
||||||
|
|
||||||
|
|
||||||
def rss_to_dict(url):
|
def rss_to_dict(url):
|
||||||
response = requests.get(url)
|
response = requests.get(url)
|
||||||
data = xmltodict.parse(response.content)
|
data = xmltodict.parse(response.content)
|
||||||
|
|
||||||
#print(data['rss'])
|
#print(data['rss'])
|
||||||
|
|
||||||
title = data['rss']['channel']['title']
|
title = data['rss']['channel']['title']
|
||||||
|
|
||||||
|
#Get the keys if needed of debug
|
||||||
|
#print(data['rss'].keys())
|
||||||
|
|
||||||
#use first object as it's ordered in a chronological order
|
#use first object as it's ordered in a chronological order
|
||||||
today_object = data['rss']['channel']['item'][0]
|
today_object = data['rss']['channel']['item'][0]
|
||||||
today_title = today_object['title']
|
today_title = today_object['title']
|
||||||
today_podcast_url = data['rss']['channel']['item'][0]['enclosure']['@url']
|
today_podcast_url = data['rss']['channel']['item'][0]['enclosure']['@url']
|
||||||
|
|
||||||
return title,today_title,today_podcast_url
|
return title,today_title,today_podcast_url
|
||||||
|
|
||||||
def download_news_mp3(url_mp3, filename):
|
def download_news_mp3(url_mp3, filename):
|
||||||
|
|||||||
Reference in New Issue
Block a user