Esempio n. 1
0
def generate_podcast_xml(podcasts):
    podcast = Podcast(name=config.PODCAST_NAME,
                      description=config.PODCAST_DESCRIPTION,
                      website=config.PODCAST_WEBSITE,
                      explicit=config.PODCAST_CONTAINS_EXPLICIT_CONTENT,
                      withhold_from_itunes=True)
    podcast.episodes = podcasts
    return podcast.rss_str()
    media_url = res.groups()[0].decode()
    head = requests.head(url)
    if '\n' in title:
       title = title.split('\n')[-1]
    episodes.append(
       Episode(
          title=title.title(),
          media=Media(media_url, head.headers["Content-Length"]),
          summary=soup.title.text,
          publication_date=arrow.get(date, "DD MMM. YYYY", locale="pt").datetime
       )
   )


# Add some episodes
p.episodes = episodes
# Generate the RSS feed
rss = p.rss_str()

filename = "alta-tensao.xml"

with open(filename, "wb") as f:
   f.write(rss.encode())

session = boto3.session.Session()
client = session.client(
   's3',
   region_name=REGION,
   endpoint_url=f'https://{REGION}.digitaloceanspaces.com',
   aws_access_key_id=ACCESS_KEY,
   aws_secret_access_key=ACCESS_SECRET
Esempio n. 3
0
talks = soup.find_all('div', class_='sqs-audio-embed')

p = Podcast(
    name="ASW Talks",
    description="Talks from ASW.",
    website=URL,
    explicit=False,
)
items = []

for talk in talks:
    dateSpeaker = talk['data-author'].split(" - ")
    date = processDate(dateSpeaker[0])
    speaker = "None" if len(dateSpeaker) < 2 else dateSpeaker[1]
    if (talk['data-url'] == ""):
        continue
    else:
        items.append(
            Episode(title=talk['data-title'],
                    media=Media(url=talk['data-url']),
                    summary=f'A talk from ASW by {speaker} on {date}'
                    # author = speaker,
                    # pubDate = date
                    ))

# Add some episodes
p.episodes = items
# Generate the RSS feed
rss = p.rss_str()

print(rss)