GNews icon indicating copy to clipboard operation
GNews copied to clipboard

Add Export to CSV Function

Open ranahaani opened this issue 2 months ago • 2 comments

Description

Add comprehensive export functionality to GNews, allowing users to export news articles to CSV format. This will make it easier for users to analyze news data in spreadsheet applications or data analysis tools.

Why?

Export functionality is essential for data analysis workflows. Users often need to save news data for further processing, analysis, or sharing. CSV format is widely supported and easy to work with.

How?

Add a new method export_to_csv() to the GNews class that:

  • Takes a list of articles and a filename
  • Exports articles to CSV format with proper headers
  • Handles encoding and special characters properly
  • Includes all article fields (title, description, url, publisher, published_date)

Files to Modify

  • gnews/gnews.py (add export method)

Acceptance Criteria

  • [ ] export_to_csv() method added to GNews class
  • [ ] Method handles all article fields properly
  • [ ] CSV output includes proper headers
  • [ ] Handles encoding and special characters
  • [ ] Method includes error handling
  • [ ] Tests added for export functionality
  • [ ] Documentation updated with usage examples

Example Usage

from gnews import GNews

google_news = GNews()
articles = google_news.get_news('artificial intelligence')
google_news.export_to_csv(articles, 'ai_news.csv')

Resources

Difficulty: Easy

Time Estimate: 1-2 hours

ranahaani avatar Oct 21 '25 04:10 ranahaani

@ranahaani I'd like to work on this issue. Could you please assign it to me?

debug-soham avatar Oct 21 '25 05:10 debug-soham

Looks good, Approved

ranahaani avatar Oct 26 '25 09:10 ranahaani