Skip to content

Commit

Permalink
1.增加对磁力王的适配
Browse files Browse the repository at this point in the history
2.过滤结果中的换行符和空格
  • Loading branch information
youusername committed Sep 6, 2019
1 parent 3aef335 commit 7c33265
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 7 deletions.
6 changes: 6 additions & 0 deletions magnetX.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
AAC820E11DB9F27500D12963 /* SourceList.plist in Resources */ = {isa = PBXBuildFile; fileRef = AAC820E01DB9F27500D12963 /* SourceList.plist */; };
AAC820E41DB9FF3B00D12963 /* breakDownHtml.m in Sources */ = {isa = PBXBuildFile; fileRef = AAC820E31DB9FF3B00D12963 /* breakDownHtml.m */; };
AAE4C0181DC07E710000D0B9 /* NSTableView+ContextMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = AAE4C0171DC07E710000D0B9 /* NSTableView+ContextMenu.m */; };
B6FFDD432322079A0075317C /* NSString+XTNSString.m in Sources */ = {isa = PBXBuildFile; fileRef = B6FFDD422322079A0075317C /* NSString+XTNSString.m */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand Down Expand Up @@ -108,6 +109,8 @@
AAC820E31DB9FF3B00D12963 /* breakDownHtml.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = breakDownHtml.m; sourceTree = "<group>"; };
AAE4C0161DC07E710000D0B9 /* NSTableView+ContextMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSTableView+ContextMenu.h"; sourceTree = "<group>"; };
AAE4C0171DC07E710000D0B9 /* NSTableView+ContextMenu.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSTableView+ContextMenu.m"; sourceTree = "<group>"; };
B6FFDD412322079A0075317C /* NSString+XTNSString.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSString+XTNSString.h"; sourceTree = "<group>"; };
B6FFDD422322079A0075317C /* NSString+XTNSString.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSString+XTNSString.m"; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -284,6 +287,8 @@
AAC820E31DB9FF3B00D12963 /* breakDownHtml.m */,
61B0E20E1E7CFC6300C2C6C3 /* UserEditorStatus.h */,
61B0E20F1E7CFC6300C2C6C3 /* UserEditorStatus.m */,
B6FFDD412322079A0075317C /* NSString+XTNSString.h */,
B6FFDD422322079A0075317C /* NSString+XTNSString.m */,
);
name = Model;
sourceTree = "<group>";
Expand Down Expand Up @@ -443,6 +448,7 @@
612BA62C1FE2AEDD005EDC47 /* GitHubProgressWindowController.m in Sources */,
61B0E2101E7CFC6300C2C6C3 /* UserEditorStatus.m in Sources */,
1F161DE91DBA457D0037BDBF /* sideModel.m in Sources */,
B6FFDD432322079A0075317C /* NSString+XTNSString.m in Sources */,
AAC820E41DB9FF3B00D12963 /* breakDownHtml.m in Sources */,
612BA62B1FE2AEDD005EDC47 /* NSString+GitHubUpdates.m in Sources */,
612BA6291FE2AEDD005EDC47 /* GitHubRelease.m in Sources */,
Expand Down
17 changes: 17 additions & 0 deletions magnetX/NSString+XTNSString.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// NSString+XTNSString.h
// magnetX
//
// Created by finn on 2019/9/6.
// Copyright © 2019 214644496@qq.com. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface NSString (XTNSString)
- (NSString*)clearSpace;
@end

NS_ASSUME_NONNULL_END
18 changes: 18 additions & 0 deletions magnetX/NSString+XTNSString.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// NSString+XTNSString.m
// magnetX
//
// Created by finn on 2019/9/6.
// Copyright © 2019 214644496@qq.com. All rights reserved.
//

#import "NSString+XTNSString.h"

@implementation NSString (XTNSString)
- (NSString*)clearSpace{

NSString *clearStr = [self stringByReplacingOccurrencesOfString:@"\n" withString:@""];

return [clearStr stringByReplacingOccurrencesOfString:@" " withString:@""];
}
@end
7 changes: 4 additions & 3 deletions magnetX/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#import <WebKit/WebKit.h>
#import "MLHudAlert.h"
#import "AppDelegate.h"
#import "NSString+XTNSString.h"

@interface ViewController()<NSTableViewDataSource, NSTableViewDelegate, NSTextFieldDelegate,ContextMenuDelegate,WKUIDelegate,WKNavigationDelegate>

Expand Down Expand Up @@ -303,13 +304,13 @@ - (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn
}else{
MovieModel *torrent = self.magnets[row];
if ([identifier isEqualToString:@"nameCell"]) {
return [self tableView:tableView identifier:identifier setValue:torrent.name];
return [self tableView:tableView identifier:identifier setValue:torrent.name.clearSpace];
}
if ([identifier isEqualToString:@"sizeCell"]) {
return [self tableView:tableView identifier:identifier setValue:torrent.size];
return [self tableView:tableView identifier:identifier setValue:torrent.size.clearSpace];
}
if ([identifier isEqualToString:@"countCell"]) {
return [self tableView:tableView identifier:identifier setValue:torrent.count];
return [self tableView:tableView identifier:identifier setValue:torrent.count.clearSpace];
}
if ([identifier isEqualToString:@"sourceCell"]) {
return [self tableView:tableView identifier:identifier setValue:torrent.magnet];
Expand Down
8 changes: 4 additions & 4 deletions rule.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
"site": "磁力王",
"waiting": "0",
"group": "//div[@class\u003d\"single_cont\"]",
"magnet": "./ul[1]/li/h3/a/@data-src",
"name": "./ul[1]/li/h3/a",
"size": "./ul[2]/li[2]/span",
"count": "./ul[2]/li[1]/text()",
"magnet": "*//h3/a/@data-src",
"name": "*//h3/a",
"size": "*//li[2]/span",
"count": "*//li[1]/text()",
"source": "https://www.ciliwang.club/list.html?keyword\u003dXXX\u0026page\u003dPPP"
},
{
Expand Down

0 comments on commit 7c33265

Please sign in to comment.