#pragma once

#include <string>
#include <vector>

#include "torlinkc/sources/types.hpp"

namespace torlinkc {

std::string unescapeEntities(const std::string& s);

// Fetches a WordPress RSS2 feed (search or /feed/, deepening into further
// pages if the first is full) and extracts magnet-bearing <item> entries.
// Ported from sources/rss.ts::fetchWordpressRss. Shared today by fitgirl;
// structurally similar to (but not shared with) nyaa's custom RSS parsing,
// matching the original.
std::vector<TorrentResult> fetchWordpressRss(const std::string& base, const std::string& sourceId,
                                              const std::string& query, const SearchOptions& opts = {});

}  // namespace torlinkc
