google-news-trends-mcp 0.2.1__py3-none-any.whl → 0.2.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -82,17 +82,10 @@ def topic(topic, period, max_results, no_nlp):
82
82
  @cli.command(help=get_trending_terms.__doc__)
83
83
  @click.option("--geo", type=str, default="US", help="Country code, e.g. 'US', 'GB', 'IN', etc.")
84
84
  @click.option("--full-data", is_flag=True, default=False, help="Return full data for each trend.")
85
- @click.option(
86
- "--max-results",
87
- "max_results",
88
- type=int,
89
- default=100,
90
- help="Maximum number of results to return.",
91
- )
92
- def trending(geo, full_data, max_results):
85
+ def trending(geo, full_data):
93
86
  # Browser not used for Google Trends
94
87
  async def _trending():
95
- trending_terms = await get_trending_terms(geo=geo, full_data=full_data, max_results=max_results)
88
+ trending_terms = await get_trending_terms(geo=geo, full_data=full_data)
96
89
  if trending_terms:
97
90
  print("Trending terms:")
98
91
  for term in trending_terms:
@@ -14,7 +14,7 @@ import newspaper # newspaper4k
14
14
  from googlenewsdecoder import gnewsdecoder
15
15
  import cloudscraper
16
16
  from playwright.async_api import async_playwright, Browser, Playwright
17
- from trendspy import Trends, TrendKeyword
17
+ from trendspy import Trends, TrendKeywordLite
18
18
  from typing import Optional, cast, overload, Literal, Awaitable
19
19
  from contextlib import asynccontextmanager, AsyncContextDecorator
20
20
  import logging
@@ -276,27 +276,27 @@ async def get_news_by_topic(
276
276
 
277
277
  @overload
278
278
  async def get_trending_terms(
279
- geo: str = "US", full_data: Literal[False] = False, max_results: int = 100
279
+ geo: str = "US", full_data: Literal[False] = False
280
280
  ) -> list[dict[str, int]]:
281
281
  pass
282
282
 
283
283
 
284
284
  @overload
285
285
  async def get_trending_terms(
286
- geo: str = "US", full_data: Literal[True] = True, max_results: int = 100
287
- ) -> list[TrendKeyword]:
286
+ geo: str = "US", full_data: Literal[True] = True
287
+ ) -> list[TrendKeywordLite]:
288
288
  pass
289
289
 
290
290
 
291
291
  async def get_trending_terms(
292
- geo: str = "US", full_data: bool = False, max_results: int = 100
293
- ) -> list[dict[str, int]] | list[TrendKeyword]:
292
+ geo: str = "US", full_data: bool = False
293
+ ) -> list[dict[str, int]] | list[TrendKeywordLite]:
294
294
  """
295
295
  Returns google trends for a specific geo location.
296
296
  """
297
297
  try:
298
- trends = list(tr.trending_now(geo=geo))
299
- trends = list(sorted(trends, key=lambda tt: tt.volume, reverse=True))[:max_results]
298
+ trends = cast(list[TrendKeywordLite], tr.trending_now_by_rss(geo=geo))
299
+ trends = sorted(trends, key=lambda tt: int(tt.volume[:-1]), reverse=True)
300
300
  if not full_data:
301
301
  return [{"keyword": trend.keyword, "volume": trend.volume} for trend in trends]
302
302
  return trends
@@ -63,25 +63,16 @@ class TrendingTermArticleOut(BaseModelClean):
63
63
 
64
64
  class TrendingTermOut(BaseModelClean):
65
65
  keyword: Annotated[str, Field(description="Trending keyword.")]
66
- volume: Annotated[Optional[int], Field(description="Search volume.")] = None
67
- geo: Annotated[Optional[str], Field(description="Geographic location code.")] = None
68
- started_timestamp: Annotated[
69
- Optional[list],
70
- Field(description="When the trend started (year, month, day, hour, minute, second)."),
71
- ] = None
72
- ended_timestamp: Annotated[
73
- Optional[list],
74
- Field(description="When the trend ended (year, month, day, hour, minute, second)."),
75
- ] = None
76
- volume_growth_pct: Annotated[Optional[float], Field(description="Percentage growth in search volume.")] = None
66
+ volume: Annotated[Optional[str], Field(description="Search volume.")] = None
77
67
  trend_keywords: Annotated[Optional[list[str]], Field(description="Related keywords.")] = None
78
- topics: Annotated[Optional[list[str | int]], Field(description="Related topics.")] = None
68
+ link: Annotated[Optional[str], Field(description="URL to more information.")] = None
69
+ started: Annotated[Optional[int], Field(description="Unix timestamp when the trend started.")] = None
70
+ picture: Annotated[Optional[str], Field(description="URL to related image.")] = None
71
+ picture_source: Annotated[Optional[str], Field(description="Source of the picture.")] = None
79
72
  news: Annotated[
80
73
  Optional[list[TrendingTermArticleOut]],
81
74
  Field(description="Related news articles."),
82
75
  ] = None
83
- news_tokens: Annotated[Optional[list], Field(description="Associated news tokens.")] = None
84
- normalized_keyword: Annotated[Optional[str], Field(description="Normalized form of the keyword.")] = None
85
76
 
86
77
 
87
78
  @asynccontextmanager
@@ -310,13 +301,18 @@ async def get_trending_terms(
310
301
  bool,
311
302
  Field(description="Return full data for each trend. Should be False for most use cases."),
312
303
  ] = False,
313
- max_results: Annotated[int, Field(description="Maximum number of results to return.", ge=1)] = 100,
314
304
  ) -> list[TrendingTermOut]:
315
305
  if not full_data:
316
- trends = await news.get_trending_terms(geo=geo, full_data=False, max_results=max_results)
306
+ trends = await news.get_trending_terms(geo=geo, full_data=False)
317
307
  return [TrendingTermOut(keyword=str(tt["keyword"]), volume=tt["volume"]) for tt in trends]
318
- trends = await news.get_trending_terms(geo=geo, full_data=True, max_results=max_results)
319
- return [TrendingTermOut(**tt.__dict__) for tt in trends]
308
+ trends = await news.get_trending_terms(geo=geo, full_data=True)
309
+ trends_out = []
310
+ for trend in trends:
311
+ trend = trend.__dict__
312
+ if 'news' in trend:
313
+ trend["news"] = [TrendingTermArticleOut(**article.__dict__) for article in trend["news"]]
314
+ trends_out.append(TrendingTermOut(**trend))
315
+ return trends_out
320
316
 
321
317
 
322
318
  def main():
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: google-news-trends-mcp
3
- Version: 0.2.1
4
- Summary: An MCP server to access Google News and Google Trends.
3
+ Version: 0.2.2
4
+ Summary: An MCP server to access RSS feeds of Google News and Google Trends
5
5
  Author-email: Jesse Manek <jesse.manek@gmail.com>
6
6
  License-Expression: MIT
7
7
  Project-URL: Homepage, https://github.com/jmanek/google-news-trends-mcp
@@ -27,11 +27,11 @@ Dynamic: license-file
27
27
 
28
28
  # Google News Trends MCP
29
29
 
30
- An MCP server to access Google News and Google Trends.
30
+ An MCP server to access RSS feeds of Google News and Google Trends.
31
31
 
32
32
  ## Features
33
33
 
34
- - Search Google News articles based on keyword, location, topic
34
+ - Search Google News RSS feeds for articles based on keyword, location, topic
35
35
  - Get top news stories from Google News
36
36
  - Google Trends keywords based on location
37
37
  - Optional LLM Sampling and NLP to summarize articles and extract keywords
@@ -0,0 +1,11 @@
1
+ google_news_trends_mcp/__init__.py,sha256=nDWNd6_TSf4vDQuHVBoAf4QfZCB3ZUFQ0M7XvifNJ-g,78
2
+ google_news_trends_mcp/__main__.py,sha256=ysiAk_xpnnW3lrLlzdIQQa71tuGBRT8WocbecBsY2Fs,87
3
+ google_news_trends_mcp/cli.py,sha256=IZ4UdAQ-tBnfutLcd3lGwsukpkYbdaJyuXZf7vddfLs,4383
4
+ google_news_trends_mcp/news.py,sha256=pTAUTrM8Rkp8GaTPOLOo7BkFx9mePdQeCON7C6Q32aA,12489
5
+ google_news_trends_mcp/server.py,sha256=TYVOnUVFQk2RQTGRVyHqoOMrADlHvFmfkN-0TmsuEO8,13394
6
+ google_news_trends_mcp-0.2.2.dist-info/licenses/LICENSE,sha256=5dsv2ZI5EZIer0a9MktVmILVrlp5vqH_0tPIe3bRLgE,1067
7
+ google_news_trends_mcp-0.2.2.dist-info/METADATA,sha256=W8baSQmZHv8jyLfp3ysVzZuG7zCfK4WU7NlBqGUCRxs,4458
8
+ google_news_trends_mcp-0.2.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
9
+ google_news_trends_mcp-0.2.2.dist-info/entry_points.txt,sha256=eVT3xd6YJQgsWAUBwhnffuwhXNF7yyt_uco6fjBy-1o,130
10
+ google_news_trends_mcp-0.2.2.dist-info/top_level.txt,sha256=RFheDbzhNnEV_Y3iFNm7jhRhY1P1wQgfiYqVpXCTD_U,23
11
+ google_news_trends_mcp-0.2.2.dist-info/RECORD,,
@@ -1,11 +0,0 @@
1
- google_news_trends_mcp/__init__.py,sha256=nDWNd6_TSf4vDQuHVBoAf4QfZCB3ZUFQ0M7XvifNJ-g,78
2
- google_news_trends_mcp/__main__.py,sha256=ysiAk_xpnnW3lrLlzdIQQa71tuGBRT8WocbecBsY2Fs,87
3
- google_news_trends_mcp/cli.py,sha256=3Z916898HXTigmQYEfvb7ybfbuUE7bjMC6yjT5-l6u0,4558
4
- google_news_trends_mcp/news.py,sha256=EhTIqRmFOQKAhyV8rLySaPoILX3uyKbrzO6jxo89FhA,12528
5
- google_news_trends_mcp/server.py,sha256=ZFZvCxSVLma7QlanFsXyu6gpCHZSS0y5YfnZl7HnXnc,13780
6
- google_news_trends_mcp-0.2.1.dist-info/licenses/LICENSE,sha256=5dsv2ZI5EZIer0a9MktVmILVrlp5vqH_0tPIe3bRLgE,1067
7
- google_news_trends_mcp-0.2.1.dist-info/METADATA,sha256=AdnEqmflIhFNUV052z9VHIOum2x0_TzI_e3hK84vdfM,4419
8
- google_news_trends_mcp-0.2.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
9
- google_news_trends_mcp-0.2.1.dist-info/entry_points.txt,sha256=eVT3xd6YJQgsWAUBwhnffuwhXNF7yyt_uco6fjBy-1o,130
10
- google_news_trends_mcp-0.2.1.dist-info/top_level.txt,sha256=RFheDbzhNnEV_Y3iFNm7jhRhY1P1wQgfiYqVpXCTD_U,23
11
- google_news_trends_mcp-0.2.1.dist-info/RECORD,,