snowchains
snowchains copied to clipboard
Parsing error on codeforces contests with admin rights
Trying to get problem names from a codeforces contest where the logged in user has admin rights fails because the html table has an extra row which is not a problem.
A potential fix is to use filter_map instead of map then collecting into Option<Vec<_>> here:
https://github.com/qryxip/snowchains/blob/master/snowchains_core/src/web/codeforces.rs#L518
But I don't know if this is the best solution, since maybe it can silently skip problems if the table looks different for other reasons.

HTML for the last two rows in from the screenshot:
<tr class="accepted-problem">
<td class="id dark left">
<a href="/contest/1628/problem/F">
F
</a>
</td>
<td class="dark">
<div style="position: relative;">
<div style="float: left;">
<a href="/contest/1628/problem/F"><!--
-->Spaceship Crisis Management<!--
--></a><!--
-->
</div>
<div style="position:absolute;right:0;top:-0.5em;font-size:1rem;padding-top:1px;text-align:right;" class="notice">
<div>
standard input/output
</div>
8 s, 256 MB
</div>
</div>
</td>
<td class="act dark">
<span class="act-item">
<a href="/contest/1628/submit/F"><img src="//cdn.codeforces.com/s/78453/images/icons/submit-22x22.png" title="Submit" alt="Submit"></a>
</span>
<span class="act-item" style="position: relative; bottom: 2px;"><span>
<img style="cursor: pointer" class="toggle-favourite add-favourite" title="Add to favourites" alt="Add to favourites" data-type="PROBLEM" data-entityid="1270548" data-size="16" src="//cdn.codeforces.com/s/78453/images/icons/star_gray_16.png">
</span></span>
</td>
<td style="font-size: 1.1rem;" class="dark">
<a title="Participants solved the problem" href="/contest/1628/status/F"><img style="vertical-align: middle;" src="//cdn.codeforces.com/s/78453/images/icons/user.png"> x58</a>
</td>
<td class="dark right">
<a href="/contest/1628/problems/edit/1270548"><img src="//cdn.codeforces.com/s/78453/images/actions/edit.png" alt="Edit" title="Edit"></a>
</td>
</tr><tr>
<td class="id bottom left">
<a href="/contest/1628/problems/new"><img src="//cdn.codeforces.com/s/78453/images/icons/new-problem-16x16.png"></a>
</td>
<td colspan="4" class="bottom right">
<div style="position: relative;">
<div style="float: left;">
<a href="/contest/1628/problems/new">Add new problem</a>
|
<a href="/contest/1628/problems/newFromContest">
Add new problems from contest
</a>
</div>
</div>
</td>
</tr>