View Single Post
Old 08-21-2020, 09:25 AM   #3
VoHegg
Enthusiast
VoHegg began at the beginning.
 
Posts: 32
Karma: 10
Join Date: Sep 2013
Location: DE
Device: Linux PC's, Android devices, Amazon Fire HD10
letz do a look inside

Whats happend here?

Code:
class google_news_sample(BasicNewsRecipe):
    # variables you should change to fit your requests!
    # here are a sample for an english speaking user intrested in ebook content and news from Denver Colorado
    #       
    searchfor = 'ebook'		# a serarch topic, filled into the string below. You can change that to anything google news should be searched for...
    my_language_id = 'en' 	# may us, de,  or other.... change this if you want
    location	= 'DenverCo'

     # Titel of the Recipe - this is a sample
    title = 'Google News sample'
    cover_url = 'https://upload.wikimedia.org/wikipedia/commons/thumb/d/da/Google_News_icon.svg/500px-Google_News_icon.svg.png'
    # Author
    __author__ = 'Volker Heggemann, VoHe'

# delete some stuff here
    
# feel free to add, wipe out what you need	 							---- can be edit by user
    #
    feeds          = [
                       ('Google news for '+location, 
                            'https://news.google.com/news/rss/headlines/section/geo/'+location),
                       ('Google news intrested in '+searchfor, 
                            'https://news.google.com/news?cf=all&hl='+my_language_id+'+&pz=1&ned='+my_language_id+'&q='+searchfor+'&output=rss'),
                     ]
because of the variables above the URL's this:
Code:
('Google news for '+location,'https://news.google.com/news/rss/headlines/section/geo/'+location)
changes to:
Code:
('Google news for DenverCo','https://news.google.com/news/rss/headlines/section/geo/DenverCo')
and this:
Code:
('Google news intrested in '+searchfor,'https://news.google.com/news?cf=all&hl='+my_language_id+'+&pz=1&ned='+my_language_id+'&q='+searchfor+'&output=rss')
now is:
Code:
('Google news intrested in ebook','https://news.google.com/news?cf=all&hl=en+&pz=1&ned=en&q=ebook&output=rss')
that's the whole trick.
So if YOU change the variables at the beginning (and may you need the news.google.com URL to the one of your country) you can get news for any place and any theme you intressted in.
VoHegg is offline   Reply With Quote