Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add news feeds for more countries #48

Closed
5 tasks
krisgesling opened this issue Jul 30, 2019 · 12 comments
Closed
5 tasks

Add news feeds for more countries #48

krisgesling opened this issue Jul 30, 2019 · 12 comments

Comments

@krisgesling
Copy link
Contributor

krisgesling commented Jul 30, 2019

A generic issue thread for the addition of new feeds or stations, particularly for countries that aren't yet represented. Contributions are warmly welcomed!

A list of the existing feeds can be found here:

FEEDS = {
"other" : ("your custom feed", None),
"custom" : ("your custom feed", None),
"ABC" : ("ABC News Australia", "https://rss.whooshkaa.com/rss/podcast/id/2381"),
"AP" : ("AP Hourly Radio News", "http://www.spreaker.com/show/1401466/episodes/feed"),
"BBC" : ("BBC News", "http://podcasts.files.bbci.co.uk/p02nq0gn.rss"),
"CBC" : ("CBC News", "http://www.cbc.ca/podcasting/includes/hourlynews.xml"),
"DLF" : ("DLF", "https://www.deutschlandfunk.de/podcast-nachrichten.1257.de.podcast.xml"),
"Ekot" : ("Ekot", "https://api.sr.se/api/rss/pod/3795"),
"FOX" : ("Fox News", "http://feeds.foxnewsradio.com/FoxNewsRadio"),
"NPR" : ("NPR News Now", "http://www.npr.org/rss/podcast.php?id=500005"),
"PBS" : ("PBS NewsHour", "https://www.pbs.org/newshour/feeds/rss/podcasts/show"),
"VRT" : ("VRT Nieuws", "https://progressive-audio.lwc.vrtcdn.be/content/fixed/11_11niws-snip_hi.mp3"),
"WDR" : ("WDR", "https://www1.wdr.de/mediathek/audio/wdr-aktuell-news/wdr-aktuell-152.podcast"),
"YLE" : ("YLE", "https://feeds.yle.fi/areena/v1/series/1-1440981.rss")
}

New feeds being proposed must include:

  • Title - eg "AP Hourly Radio News"
  • Shortcode - eg "AP"
  • Feed URL - eg "http://www.spreaker.com/show/1401466/episodes/feed"
    The feed URL may be an RSS feed or a direct audio feed.
  • Alternative names that may be used by a user - eg "Associated Press"
  • Logo - a (preferably square) logo to display on any GUI available.
@JarbasAl
Copy link

JarbasAl commented Aug 2, 2019

NOTE these feeds can't be used directly

  • TSF [PT]
import requests

def get_tsf():
        feed = "https://www.tsf.pt/stream/audio/{year}/{month:02d}/noticias/{day:02d}/not{hour:02d}.mp3"
        uri = None
        i = 0
        status = 404
        while status != 200 and i < 5:
            uri = feed.format(hour=date.hour, year=date.year, month=date.month, day=date.day)
            status = requests.get(uri).status_code
            i += 1
        return uri
  • GBP, Georgia Public Radio
def get_gbp():
        feed = "http://feeds.feedburner.com/gpbnews/GeorgiaRSS?format=xml"
        data = feedparser.parse(feed)
        next_link = data["entries"][0]["links"][0]["href"]
        html = requests.get(next_link)
        # Find the first mp3 link
        # Note that the latest mp3 may not be news,
        # but could be an interview, etc.
        mp3_find = re.search(b'href="(?P<mp3>.+\.mp3)"', html.content)
        if mp3_find is None:
            return None
        url = mp3_find.group("mp3").decode("utf-8")
        return url

@krisgesling
Copy link
Contributor Author

Thanks Jarbas - PR #50 is in motion!

@mantasbandonis
Copy link
Contributor

mantasbandonis commented Mar 26, 2020

Title - "Ö3 Nachrichten"
Shortcode - "OE3"
Feed URL (can be used directly) - "https://oe3meta.orf.at/oe3mdata/StaticAudio/Nachrichten.mp3"
Alternative names that may be used by a user - "Hitradio Ö3", "Austrian News"
Country - Austria (AT)

@dcstang
Copy link
Contributor

dcstang commented Apr 24, 2020

Title - "Financial Times News Briefing"
Shortcode - "FT"
Feed URL (cant be used directly) - "https://www.ft.com/newsbriefing"
Alternative names that may be used by a user - "FT News"
Country - United Kingdom (UK)

from bs4 import BeautifulSoup
from urllib.request import urlopen
from datetime import date

def ft():
    """Custom news fetcher for today's FT news briefing"""
    url = 'https://www.ft.com/newsbriefing'
    page = urlopen(url)

    #init today's date
    today = date.today()
    d1 = today.strftime('%A, %d %B, %Y')

    #use bs4 to parse website and get mp3 link
    soup = BeautifulSoup(page, features='html.parser')
    result = soup.find('time')

    # check if div matches today's date
    if result.contents == [d1]:
        targetDiv = result.parent.find_next('div')
        targetURL = 'http://www.ft.com' + targetDiv.a['href']

        mp3URL = targetURL
        mp3Page = urlopen(mp3URL)
        mp3Soup = BeautifulSoup(mp3Page, features='html.parser')

        return mp3Soup.find('source')['src']

This is a channel that I use daily. Thought of contributing it so that others can use it as well. Unfortunately had to use bs4 because the mp3 links are hidden behind a second page!

@krisgesling
Copy link
Contributor Author

Thanks @dcstang this looks great!

Given that it all looks good to go, feel free to create a PR directly. We love to keep a record of community contributions. But if you don't have time I can get this integrated for you.

@dcstang
Copy link
Contributor

dcstang commented Apr 24, 2020

Contributing to open source is awesome! Have put it in as #73.

@denics
Copy link
Contributor

denics commented Jun 8, 2020

Hello guys! while I was trying to add RAI Radio 1 to your great skill, I came with an idea: why don't do a plugin mechanism with a file per feed and the file can return or a feed RSS type or an audio file to play directly?

@krisgesling
Copy link
Contributor Author

Hey Denics, very open if you have suggestions on better ways to organize the feeds. A full-blown plugin system might be overkill, but may depend on whether the plugins must be installed by the user or just in the skill?

@denics
Copy link
Contributor

denics commented Jun 12, 2020

Hi @krisgesling I was thinking more about a "drop in" plugins folder, with one file per radio. As I said, I am for example adding Radio Rai 1. Instead of putting my hands in your code with the risk to break everything or doing a pull request that can potentially compromise something, it could be more useful for advanced users, to drop in that folder a file radiorai1.py (or whatever naming convention defined by you) that can return OR an RSS feed OR an MP3/ASF/nameit stream.

@thorstenMueller
Copy link

Hi @krisgesling .
I've added a german newsstation (feed) for the state of Hessen in PR #96 .
Maybe (hopefully) it's helpful.

@denics
Copy link
Contributor

denics commented Jun 7, 2022

Hi @krisgesling shall we close this issue?

@denics denics mentioned this issue Jun 7, 2022
@krisgesling
Copy link
Contributor Author

Yeah it's definitely dated - I'll add a new version when we are ready to completely add new stations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants