юрій бабій юрій бабій - 10 months ago 54
C# Question

Can't take more than 30 entries from atom feed (GitHub private feed)

I am taking atom feed with this code:

var client = new HttpClient(new NativeMessageHandler());

var feed = await client.GetStringAsync(_session.GetPrivateFeedUrl());

if ( string.IsNullOrEmpty(feed) ) return new List<XElement>();

var parsedFeed = XElement.Parse(feed);

var entries = from entry in parsedFeed.Elements("{" + ConstantsService.AtomNamespace + "}entry") select entry;

return entries;

But this takes only 30 entries (reads). And I think it is because if you open private feed token url, that you will see only 30 elements of feed. And if you go on https://github.com/ , it is still 30, but there you can press "More" button, but you can't do this with page from url. How to take more than 30 elements (all) ?

Answer Source

So, I didn't find the answer how to get more than 30 items, but I figured out how to read from another page, where you have another 30 items, and so on. After your private feed URL, you should add this: &page=2 In this case, you will read the second page. If you don't add a page, it reads the first page. If someone will find way to get more than 30 items from page, please share it.