Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add contest parser for MarisaOJ #555

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ A browser extension which parses competitive programming problems from various o
| LightOJ | ✔ | ✔ |
| LSYOI | ✔ | |
| Luogu | ✔ | ✔ |
| MarisaOJ | ✔ | |
| MarisaOJ | ✔ | |
| Mendo | ✔ | |
| Meta Coding Competitions | ✔ | |
| MOI Arena | ✔ | ✔ |
Expand Down
11 changes: 11 additions & 0 deletions src/parsers/contest/MarisaOJContestParser.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { MarisaOJProblemParser } from '../problem/MarisaOJProblemParser';
import { SimpleContestParser } from '../SimpleContestParser';

export class MarisaOJContestParser extends SimpleContestParser {
protected linkSelector = '.problem-table tbody > tr > td:nth-child(2) > a';
protected problemParser = new MarisaOJProblemParser();

public getMatchPatterns(): string[] {
return ['https://marisaoj.com/mashup/*'];
}
}
2 changes: 2 additions & 0 deletions src/parsers/parsers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { LanqiaoContestParser } from './contest/LanqiaoContestParser';
import { LibreOJContestParser } from './contest/LibreOJContestParser';
import { LightOJContestParser } from './contest/LightOJContestParser';
import { LuoguContestParser } from './contest/LuoguContestParser';
import { MarisaOJContestParser } from './contest/MarisaOJContestParser';
import { NBUTOnlineJudgeContestParser } from './contest/NBUTOnlineJudgeContestParser';
import { NOJContestParser } from './contest/NOJContestParser';
import { OpenJudgeContestParser } from './contest/OpenJudgeContestParser';
Expand Down Expand Up @@ -299,6 +300,7 @@ export const parsers: Parser[] = [
new LuoguContestParser(),

new MarisaOJProblemParser(),
new MarisaOJContestParser(),

new MendoProblemParser(),

Expand Down
2 changes: 1 addition & 1 deletion src/parsers/problem/MarisaOJProblemParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Parser } from '../Parser';

export class MarisaOJProblemParser extends Parser {
public getMatchPatterns(): string[] {
return ['https://marisaoj.com/problem/*'];
return ['https://marisaoj.com/problem/*', 'https://marisaoj.com/mashup/*/problem/*'];
}

public async parse(url: string, html: string): Promise<Sendable> {
Expand Down