<commit_before>package net.maxbraun.mirror;

import android.text.TextUtils;
import android.util.Log;
import android.util.Xml;

import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;

/**
 * A helper class to regularly retrieve news headlines.
 */
public class News extends DataUpdater<List<String>> {
  private static final String TAG = News.class.getSimpleName();

  /**
   * The URL of the "Top News" RSS feed from Reuters.
   */
  private static final String NEWS_RSS_URL =
      "https://content.api.nytimes.com/svc/news/v3/all/recent.rss";

  /**
   * The time in milliseconds between API calls to update the news.
   */
  private static final long UPDATE_INTERVAL_MILLIS = TimeUnit.MINUTES.toMillis(5);

  /**
   * A parser for the news feed XML.
   */
  private final XmlPullParser parser;

  public News(UpdateListener<List<String>> updateListener) {
    super(updateListener, UPDATE_INTERVAL_MILLIS);

    parser = Xml.newPullParser();
    try {
      parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, false);
    } catch (XmlPullParserException e) {
      Log.e(TAG, "Failed to initialize XML parser.", e);
    }
  }

  @Override
  protected List<String> getData() {
    // Get the latest headlines.
    String response = Network.get(NEWS_RSS_URL);
    if (response == null) {
      Log.w(TAG, "Empty response.");<commit_msg>Switch to a BBC news feed<commit_after>package net.maxbraun.mirror;

import android.text.TextUtils;
import android.util.Log;
import android.util.Xml;

import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;

/**
 * A helper class to regularly retrieve news headlines.
 */
public class News extends DataUpdater<List<String>> {
  private static final String TAG = News.class.getSimpleName();

  /**
   * The URL of the "World" RSS news feed from the BBC.
   */
  private static final String NEWS_RSS_URL = "http://feeds.bbci.co.uk/news/world/rss.xml";

  /**
   * The time in milliseconds between API calls to update the news.
   */
  private static final long UPDATE_INTERVAL_MILLIS = TimeUnit.MINUTES.toMillis(5);

  /**
   * A parser for the news feed XML.
   */
  private final XmlPullParser parser;

  public News(UpdateListener<List<String>> updateListener) {
    super(updateListener, UPDATE_INTERVAL_MILLIS);

    parser = Xml.newPullParser();
    try {
      parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, false);
    } catch (XmlPullParserException e) {
      Log.e(TAG, "Failed to initialize XML parser.", e);
    }
  }

  @Override
  protected List<String> getData() {
    // Get the latest headlines.
    String response = Network.get(NEWS_RSS_URL);
    if (response == null) {
      Log.w(TAG, "Empty response.");
{'fraction_non_alphanumeric': 0.11015831134564644, 'fraction_numerical': 0.002308707124010554, 'mean_word_length': 3.7464788732394365, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 5}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2882427', 'n_tokens_mistral': 985, 'n_tokens_neox': 940, 'n_words': 249}