Skip to content

Search news

thml.search.news

Classes:

  • GooNews

    A class that allows you to search for news articles using Google News.

Functions:

GooNews(language='en', country='US', max_results=100, period=None, start_date=None, end_date=None, exclude_websites=None, proxy=None)

Bases: GNews

A class that allows you to search for news articles using Google News.

Parameters:

  • language (str, default: 'en' ) –

    The language in which to return results. Defaults to en

  • country (str, default: 'US' ) –

    The country code of the country you want to get headlines for. Defaults to US

  • max_results (int, default: 100 ) –

    The maximum number of results to return. The default is 100. Defaults to 100

  • period (str, default: None ) –

    The period of time from which you want the news

  • start_date (str, default: None ) –

    Date after which results must have been published

  • end_date (str, default: None ) –

    Date before which results must have been published

  • exclude_websites (list, default: None ) –

    A list of strings that indicate websites to exclude from results

  • proxy (dict, default: None ) –

    The proxy parameter is a dictionary with a single key-value pair. The key is the

Methods:

  • get_article

    Download an article from the specified URL, parse it, and return an article object.

  • download_article_material

    Download the article's text, images, and videos to the specified directory.

get_article(url)

Download an article from the specified URL, parse it, and return an article object.

Parameters:

  • url (str) –

    The URL of the article you wish to summarize.

Returns:

download_article_material(url, output_dir='./article_material')

Download the article's text, images, and videos to the specified directory.

Parameters:

  • url (str) –

    The URL of the article you wish to download.

  • output_dir (str, default: './article_material' ) –

    The directory to save the article's material to. Defaults to "./article_material".

news_by_topic(topic: str)

Generate news video by topic.

Tasks: 1. Get google news by topic 2. Download article material (text, images, videos). May be only text available. 3. Search related videos (youtube, google,...) and download them. 4. Generate video

news_generator()

Generate news videos for a list of topics.

Tasks: Run news_by_topic for each topic in a given list.