mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-07 19:58:49 +00:00
parse weird message
git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@143 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
parent
dc11284996
commit
8b482b80f1
2 changed files with 15 additions and 1 deletions
|
@ -450,7 +450,8 @@ public final class BahnProvider implements NetworkProvider
|
|||
+ ">>\n\\s*(.+?)\\s*\n<br />\n" // destination
|
||||
+ "<span class=\"bold\">(\\d{1,2}:\\d{2})</span>" // time
|
||||
+ "(?: <span class=\"[\\w ]*\">(?:(pünktl\\.)|ca. \\+(\\d+))</span>)?" // ontime, delay
|
||||
+ "(?:, <span class=\"red\">([^<]*)</span>)?" // (message)
|
||||
+ "(?: k\\.A\\.)?" //
|
||||
+ "(?:, <span class=\"red\">([^<]*)</span>)?" // message
|
||||
+ "(?:(?:, )?(Gl\\. " + ParserUtils.P_PLATFORM + "))?" // position
|
||||
, Pattern.DOTALL);
|
||||
private static final Pattern P_DEPARTURES_URI_STATION_ID = Pattern.compile("input=(\\d+)");
|
||||
|
|
|
@ -78,6 +78,19 @@ public class BahnProviderTest
|
|||
+ "<span class=\"bold\">07:02</span> <span class=\"red\">ca. +5</span>, <span class=\"red\">Fährt heute nur bis Düsseldorf Hbf</span>, Gl. 10");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void departureWithWeirdMessage()
|
||||
{
|
||||
assertFineDepartures("" //
|
||||
+ "<a href=\"http://mobile.bahn.de/bin/mobil/traininfo.exe/dox/760983/402261/557174/24926/80/si=808093&bt=dep&ti=02:41&pt=02:41&p=1111111111&date=06.09.10&max=10&rt=1&&\">\n" //
|
||||
+ "<span class=\"bold\">ICE 609</span>\n" //
|
||||
+ "</a>\n" //
|
||||
+ ">>\n" //
|
||||
+ "Basel SBB\n" //
|
||||
+ "<br />\n" //
|
||||
+ "<span class=\"bold\">04:52</span> k.A., Gl. 3");
|
||||
}
|
||||
|
||||
private void assertFineConnectionDetails(String s)
|
||||
{
|
||||
Matcher m = BahnProvider.P_CONNECTION_DETAILS_FINE.matcher(s);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue