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

TorrentDetails english property #3

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 6 additions & 0 deletions src/main/java/com/github/akosbordas/ncore/TorrentDetails.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public abstract class TorrentDetails {
protected String size;
protected String fileCount;
protected String description;
protected boolean english;

public static Document parseHtml(String html){
return Jsoup.parse(html,"https://ncore.cc/");
Expand All @@ -35,6 +36,7 @@ public TorrentDetails parse(String html) {
Document document = parseHtml(html);

try {
english = extractGenericInfoColumn(1, 2, document).contains("EN");
simon-vajda marked this conversation as resolved.
Show resolved Hide resolved
uploadDate = DATE_FORMAT.parse(extractGenericInfoColumn(1, 4, document));
uploader = extractGenericInfoColumn(1, 6, document);
commentCount = extractGenericInfoColumn(1, 8, document);
Expand Down Expand Up @@ -162,6 +164,10 @@ public String getDescription() {
return description;
}

public boolean isEnglish() {
return english;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void shouldPassIfParsedAllFields() throws Exception {
assertThat(torrentDetails.getSize()).isEqualTo("965.06 MB (1011940950 bájt)");
assertThat(torrentDetails.getFileCount()).isEqualTo("2");
assertThat(torrentDetails.getDescription()).isEqualTo("Eredeti release! Inception.2010.iNTERNAL.BDRip.x264-REGRET Két ifjú és ambiciózus építész együtt dolgozik, s nem csak kollégák, hanem a legjobb barátok is, ám kapcsolatukra némi árnyék vetül. A vállalatnál kifejlesztettek egy olyan technológiát, amely segítségével be lehet lépni az álmokba, és bizonyos emberek fejéből így információhoz lehet jutni. Amikor Cobb él ezzel a lehetőséggel, a dolgok egyre bonyolultabbakká válnak... Eredet (Inception) - Magyar Szinkronos Előzetes https://www.youtube.com/watch?v=Ypu8DP2ci-M");

assertThat(torrentDetails.isEnglish()).isTrue();
}

@Test
Expand Down