Skip to content

Commit

Permalink
Merge pull request #10 from RadiationX/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
RadiationX authored Dec 15, 2020
2 parents 22c919f + 00b333c commit 35635ae
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 23 deletions.
8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ android {

def fileNaming = "apk/ForPDA"

def versionNumber = 221
def versionNumber = 223

def versionMajor = "0"
def versionMinor = "9"
def versionPatch = "8"
def versionMajor = "1"
def versionMinor = "0"
def versionPatch = "0"

def versionBuild = -1
def versionPropsFile = file('version.properties')
Expand Down
8 changes: 4 additions & 4 deletions app/src/main/assets/patterns.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": 18,
"version": 21,
"scopes": [
{
"scope":"global",
Expand Down Expand Up @@ -109,7 +109,7 @@
},
{
"key": "attachments",
"value": "(\\d+)\u0002([^\u0002]*?)\u0002([^\u0002]*?)\u0002(\\/\\/[^\u0002]*?)\u0002(\\d+)\u0002([0-9a-fA-F]+)(?:(?:\u0002(\\/\\/[^\u0002]*?)\u0002(\\d+)\u0002(\\d+))?(?:\u0003\u0004(\\d+)\u0003\u0004([^\u0002]*?)\u0003\u0004([^\u0002]*?)\u0003)?)?"
"value": "(\\d+)\u0002([^\u0002]*?)\u0002([^\u0002]*?)\u0002(?:https?:)?(\\/\\/[^\u0002]*?)\u0002(\\d+)\u0002([0-9a-fA-F]+)(?:(?:\u0002(?:https?:)?(\\/\\/[^\u0002]*?)\u0002(\\d+)\u0002(\\d+))?(?:\u0003\u0004(\\d+)\u0003\u0004([^\u0002]*?)\u0003\u0004([^\u0002]*?)\u0003)?)?"
}
]
},
Expand Down Expand Up @@ -169,11 +169,11 @@
},
{
"key": "detail",
"value": "<[^>]*>[^<]*?<[^>]*?>[^<]*?<div[^>]*?data-ztm=\"\\d+:(\\d+)[^\"]*?\"[^>]*?>[^<]*?<meta[^>]*?content=\"([^\"]*?)\"[^>]*?>[\\s\\S]*?<div[^>]*?class=\"photo\"[^>]*?>[^<]*?<img[^>]*?src=\"([^\"]*?)\"[^>]*?>[\\s\\S]*?<div[^>]*?class=\"description\"[^>]*?>[^<]*?<h1[^>]*?>(?:<span[^>]*?>)?([^<]*?)(?:<\\/span>)?<\\/h1>[\\s\\S]*?<em[^>]*?class=\"date\"[^>]*?>([^<]*?)<\\/em>[^<]*?<span[^>]*?class=\"name\"[^>]*?>[^<]*?<a[^>]*?href=\"[^\"]*?(\\d+)\"[^>]*?>([^<]*?)<\\/a>[\\s\\S]*?<div[^>]*?class=\"more-box\"[^>]*?>[^<]*?<a[^>]*?>(\\d+)<\\/a>(?:<div class=\"meta\"># )?([\\s\\S]*?)<\\/div>?[\\s\\S]*?<div class=\"content-box\" itemprop=\"articleBody\"[^>]*?>([\\s\\S]*?)<\\/div>[^<]*?<\\/div>[^<]*?<\\/div>[^<]*?<script[^>]*?>[^<]*?<\\/script>(?:[^<]*?<div class=\"materials-box\"[^>]*?>(?:[\\s\\S]*?<ul class=\"materials-slider\"[^>]*?>([\\s\\S]*?)<\\/ul>)?[^<]*?<\\/div>)?[\\s\\S]*?[^<]*?<ul class=\"page-nav[^\"]*?\">[\\s\\S]*?<a href=\"[^\"]*?\\/(\\d+)\\/\"[\\s\\S]*?<\\/ul>(?:[\\s\\S]*?<div class=\"comment-box[^\"]*?\" id=\"comments\"[^>]*?>[^<]*?(?:<div class=\"[^\"]*?close[^\"]*?\"[^>]*?>[\\s\\S]*?<\\/div>[^<]*?<\\/div>[^<]*?<div class=\"[^\"]*?open[^\"]*?\"[^>]*?>)?[\\s\\S]*?<div class=\"heading\"[^>]*?>[^>]*?<h2>[^<]*?<\\/h2>([\\s\\S]*?)<\\/div>([\\s\\S]*?)[^<]*?<br[^>]*?>[^<]*?<\\/div>[^<]*?(?:<\\/div|<ul class=\"page-nav))?"
"value": "<[^>]*>[^<]*?<[^>]*?>[^<]*?<div[^>]*?data-ztm=\"\\d+:(\\d+)[^\"]*?\"[^>]*?>[^<]*?<meta[^>]*?content=\"([^\"]*?)\"[^>]*?>[\\s\\S]*?<div[^>]*?class=\"photo\"[^>]*?>[^<]*?<img[^>]*?src=\"([^\"]*?)\"[^>]*?>[\\s\\S]*?<div[^>]*?class=\"description\"[^>]*?>[^<]*?<h1[^>]*?>(?:<span[^>]*?>)?([^<]*?)(?:<\\/span>)?<\\/h1>[\\s\\S]*?<div class=\"meta\">([\\s\\S]*?)<\\/div>[\\s\\S]*?<em[^>]*?class=\"date\"[^>]*?>([^<]*?)<\\/em>[^<]*?<span[^>]*?class=\"name\"[^>]*?>[^<]*?<a[^>]*?href=\"[^\"]*?(\\d+)\"[^>]*?>([^<]*?)<\\/a>[^<]*?<\\/span>[^<]*?<span class=\"number\">[^<]*?<a[^>]*?>(\\d+)<\\/a>[^<]*?<\\/span>[\\s\\S]*?<div class=\"content-box\" itemprop=\"articleBody\"[^>]*?>([\\s\\S]*?)<\\/div>[^<]*?<\\/div>[^<]*?<\\/div>[^<]*?<script[^>]*?>[^<]*?<\\/script>(?:[^<]*?<div class=\"materials-box\"[^>]*?>(?:[\\s\\S]*?<ul class=\"materials-slider\"[^>]*?>([\\s\\S]*?)<\\/ul>)?[^<]*?<\\/div>)?[\\s\\S]*?[^<]*?<ul class=\"page-nav[^\"]*?\">[\\s\\S]*?<a href=\"[^\"]*?\\/(\\d+)\\/\"[\\s\\S]*?<\\/ul>(?:[\\s\\S]*?<div class=\"comment-box[^\"]*?\" id=\"comments\"[^>]*?>[\\s\\S]*?(<ul class=\"comment-list[\\s\\S]*?<\\/ul>)(?:<form|<\\/div><\\/div><article))"
},
{
"key": "detail_v2",
"value": "<[^>]*>[^<]*?<[^>]*?>[^<]*?<div[^>]*?data-ztm=\"\\d+:(\\d+)[^\"]*?\"[^>]*?>[^<]*?<meta[^>]*?content=\"([^\"]*?)\"[^>]*?>[\\s\\S]*?<div class=\"[^\"]*?article[^\"]*?\"[^>]*?><div class=\"[^\"]*?article-header[^\"]*?\"[^>]*?>(?:<h1>)?([^<]*?)(?:<\\/h1>)[\\s\\S]*?<time[^>]*?>([^<]*?)<\\/time>[\\s\\S]*?<a[^>]*?href=\"#comments\"[^>]*?>(\\d+)<\\/a>[\\s\\S]*?(<meta property=\"og:description\"[\\s\\S]*?)<div class=\"article-footer[^\"]*?\"[^>]*?>[\\s\\S]*?(?:<div class=\"article-footer-tags[^\"]*?\"[^>]*?>([\\s\\S]*?)<\\/div>)?<\\/div>[^<]*?<\\/div>[^<]*?<\\/div>[^<]*?<script[^>]*?>[^<]*?<\\/script>(?:[^<]*?<div class=\"materials-box\"[^>]*?>(?:[\\s\\S]*?<ul class=\"materials-slider\"[^>]*?>([\\s\\S]*?)<\\/ul>)?[^<]*?<\\/div>)?[\\s\\S]*?[^<]*?<ul class=\"page-nav[^\"]*?\">[\\s\\S]*?<a href=\"[^\"]*?\\/(\\d+)\\/\"[\\s\\S]*?<\\/ul>(?:[\\s\\S]*?<div class=\"comment-box[^\"]*?\" id=\"comments\"[^>]*?>[^<]*?(?:<div class=\"[^\"]*?close[^\"]*?\"[^>]*?>[\\s\\S]*?<\\/div>[^<]*?<\\/div>[^<]*?<div class=\"[^\"]*?open[^\"]*?\"[^>]*?>)?[\\s\\S]*?<div class=\"heading\"[^>]*?>[^>]*?<h2>[^<]*?<\\/h2>([\\s\\S]*?)<\\/div>([\\s\\S]*?)[^<]*?<br[^>]*?>[^<]*?<\\/div>[^<]*?(?:<\\/div|<ul class=\"page-nav))?"
"value": "<[^>]*>[^<]*?<[^>]*?>[^<]*?<div[^>]*?data-ztm=\"\\d+:(\\d+)[^\"]*?\"[^>]*?>[^<]*?<meta[^>]*?content=\"([^\"]*?)\"[^>]*?>[\\s\\S]*?<div class=\"[^\"]*?article[^\"]*?\"[^>]*?><div class=\"[^\"]*?article-header[^\"]*?\"[^>]*?>(?:<h1>)?([^<]*?)(?:<\\/h1>)[\\s\\S]*?<time[^>]*?>([^<]*?)<\\/time>[\\s\\S]*?<a[^>]*?href=\"#comments\"[^>]*?>(\\d+)<\\/a>[\\s\\S]*?(<meta property=\"og:description\"[\\s\\S]*?)<div class=\"article-footer[^\"]*?\"[^>]*?>[\\s\\S]*?(?:<div class=\"article-footer-tags[^\"]*?\"[^>]*?>([\\s\\S]*?)<\\/div>)?<\\/div>[^<]*?<\\/div>[^<]*?<\\/div>[^<]*?<script[^>]*?>[^<]*?<\\/script>(?:[^<]*?<div class=\"materials-box\"[^>]*?>(?:[\\s\\S]*?<ul class=\"materials-slider\"[^>]*?>([\\s\\S]*?)<\\/ul>)?[^<]*?<\\/div>)?[\\s\\S]*?[^<]*?<ul class=\"page-nav[^\"]*?\">[\\s\\S]*?<a href=\"[^\"]*?\\/(\\d+)\\/\"[\\s\\S]*?<\\/ul>(?:[\\s\\S]*?<div class=\"comment-box[^\"]*?\" id=\"comments\"[^>]*?>[\\s\\S]*?(<ul class=\"comment-list[\\s\\S]*?<\\/ul>)(?:<form|<\\/div><\\/div><article))"
},
{
"key": "detail_detector",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ class ArticleParser(
id = matcher.group(1).toInt()
imgUrl = matcher.group(3)
title = matcher.group(4).fromHtml()
date = matcher.group(5)
authorId = matcher.group(6).toInt()
author = matcher.group(7).fromHtml()
commentsCount = matcher.group(8).toInt()
matcher.group(9)?.let {
matcher.group(5)?.let {
tags.addAll(parseTags(it))
}
date = matcher.group(6)
authorId = matcher.group(7).toInt()
author = matcher.group(8).fromHtml()
commentsCount = matcher.group(9).toInt()
html = matcher.group(10)
matcher.group(11)?.also {
materials.addAll(parseMaterials(it))
Expand All @@ -85,7 +85,7 @@ class ArticleParser(

karmaMap = parseKarma(response)

commentsSource = matcher.group(14)?.let { comments ->
commentsSource = matcher.group(13)?.let { comments ->
patternProvider
.getPattern(scope.scope, scope.exclude_form_comment)
.matcher(comments)
Expand Down Expand Up @@ -136,7 +136,7 @@ class ArticleParser(

karmaMap = parseKarma(response)

commentsSource = matcher.group(11)?.let { comments ->
commentsSource = matcher.group(10)?.let { comments ->
patternProvider
.getPattern(scope.scope, scope.exclude_form_comment)
.matcher(comments)
Expand Down Expand Up @@ -239,10 +239,12 @@ class ArticleParser(
comment.isDeleted = isDeleted

if (!isDeleted) {
val avatarNode = Parser.findNode(commentNode, "a", "class", "comment-avatar")
val nickNode = Parser.findNode(commentNode, "a", "class", "nickname")
val metaNode = Parser.findNode(commentNode, "span", "class", "h-meta")
?: Parser.findNode(commentNode, "span", "class", "nickname")
val metaNode = Parser.findNode(commentNode, "a", "class", "date")

userId = nickNode!!.getAttribute("href")
userId = avatarNode!!.getAttribute("href")
if (userId != null) {
matcher = patternProvider
.getPattern(scope.scope, scope.comment_user_id)
Expand All @@ -256,8 +258,7 @@ class ArticleParser(
userNick = Parser.getHtml(nickNode, true)
comment.userNick = ApiUtils.fromHtml(userNick)

date = Parser.ownText(metaNode!!).trim()
date = date.replace(" |", ",")
date = metaNode?.let { Parser.ownText(metaNode).trim() }
comment.date = date
}

Expand Down
6 changes: 3 additions & 3 deletions app/version.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#Fri Sep 25 21:17:23 MSK 2020
DATE_BUILD=25 сентября 2020 г.
VERSION_BUILD=13597
#Tue Dec 15 19:06:44 YEKT 2020
DATE_BUILD=15 December 2020 г.
VERSION_BUILD=13624
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@
# android.enableAapt2=false
android.enableD8.desugaring = true
android.enableJetifier=true
android.useAndroidX=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=1536m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

0 comments on commit 35635ae

Please sign in to comment.