8000 Add ci script · DuncteBot/skybot-source-managers@4abe4e6 · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Nov 26, 2023. It is now read-only.

Commit 4abe4e6

Browse files
committed
Add ci script
1 parent 6475b07 commit 4abe4e6

File tree

3 files changed

+93
-5
lines changed

3 files changed

+93
-5
lines changed

.circleci/config.yml

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Java Gradle CircleCI 2.0 configuration file
2+
#
3+
# Check https://circleci.com/docs/2.0/language-java/ for more details
4+
#
5+
version: 2
6+
jobs:
7+
build:
8+
docker:
9+
# specify the version you desire here
10+
- image: circleci/openjdk:11-jdk
11+
12+
# Specify service dependencies here if necessary
13+
# CircleCI maintains a library of pre-built images
14+
# documented at https://circleci.com/docs/2.0/circleci-images/
15+
# - image: circleci/postgres:9.4
16+
17+
working_directory: ~/repo
18+
19+
environment:
20+
# Customize the JVM maximum heap limit
21+
JVM_OPTS: -Xmx3200m
22+
TERM: dumb
23+
24+
steps:
25+
- checkout
26+
27+
# Download and cache dependencies
28+
- restore_cache:
29+
keys:
30+
- v1-dependencies-{{ checksum "build.gradle" }}
31+
# fallback to using the latest cache if no exact match is found
32+
- v1-dependencies-
33+
34+
- run: ./gradlew dependencies
35+
36+
- save_cache:
37+
paths:
38+
- ~/.gradle
39+
key: v1-dependencies-{{ checksum "build.gradle" }}
40+
41+
- run: ./gradlew build
42+
43+
# run tests!
44+
- run: ./gradlew test
45+
46+
- persist_to_workspace:
47+
root: ./
48+
paths:
49+
- ./
50+
51+
52+
deploy:
53+
docker:
54+
# specify the version you desire here
55+
- image: circleci/openjdk:11-jdk
56+
57+
# Specify service dependencies here if necessary
58+
# CircleCI maintains a library of pre-built images
59+
# documented at https://circleci.com/docs/2.0/circleci-images/
60+
# - image: circleci/postgres:9.4
61+
62+
working_directory: ~/repo
63+
64+
environment:
65+
# Customize the JVM maximum heap limit
66+
JVM_OPTS: -Xmx3200m
67+
TERM: dumb
68+
69+
steps:
70+
- attach_workspace:
71+
at: ./
72+
73+
- run:
74+
name: "Upload if on master"
75+
command: ./gradlew bintrayUpload;
76+
77+
78+
workflows:
79+
version: 2
80+
build_and_test:
81+
jobs:
82+
- build
83+
- deploy:
84+
requires:
85+
- build
86+
filters:
87+
branches:
88+
only: master

src/main/java/com/dunctebot/sourcemanagers/pornhub/PornHubAudioSourceManager.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@
5353
import java.util.regex.Pattern;
5454

5555
public class PornHubAudioSourceManager implements AudioSourceManager, HttpConfigurable {
56-
private static final Pattern VIDEO_REGEX = Pattern.compile("^https?://(www\\.)?pornhub\\.(com|net)/view_video\\.php\\?viewkey=([a-zA-Z0-9]+)(?:.*)$");
56+
public static final Pattern DOMAIN_REGEX = Pattern.compile("https?://([a-z]+\\.)?pornhub\\.(com|net)");
57+
private static final Pattern VIDEO_REGEX = Pattern.compile("^" + DOMAIN_REGEX + "/view_video\\.php\\?viewkey=([a-zA-Z0-9]+)(?:.*)$");
5758
private static final Pattern VIDEO_INFO_REGEX = Pattern.compile("var flashvars_\\d+ = (\\{.+})");
5859
private static final Pattern MODEL_INFO_REGEX = Pattern.compile("var MODEL_PROFILE = (\\{.+})");
5960
private final HttpInterfaceManager httpInterfaceManager;
@@ -77,8 +78,7 @@ public AudioItem loadItem(DefaultAudioPlayerManager manager, AudioReference refe
7778

7879
try {
7980
return loadItemOnce(reference);
80-
}
81-
catch (Exception e) {
81+
} catch (Exception e) {
8282
throw ExceptionTools.wrapUnfriendlyExceptions("Something went wrong", Severity.SUSPICIOUS, e);
8383
}
8484
}

src/main/java/com/dunctebot/sourcemanagers/pornhub/PornHubAudioTrack.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
public class PornHubAudioTrack extends DelegatedAudioTrack {
3939
private static final Pattern MEDIA_STRING = Pattern.compile("(var\\s+?mediastring.+?)<\\/script>");
40-
private static final Pattern MEDIA_STRING_FILTER = Pattern.compile("\\/\\* \\+ [a-zA-Z0-9]+ \\+ \\*\\/"); // Should be used with replaceAll
40+
private static final Pattern MEDIA_STRING_FILTER = Pattern.compile("\\/\\* \\+ [a-zA-Z0-9_]+ \\+ \\*\\/");
4141

4242
private final PornHubAudioSourceManager sourceManager;
4343

@@ -89,7 +89,7 @@ private static String parseJsValueToUrl(String htmlPage, String js) {
8989

9090
for (final String i : items) {
9191
final String item = i.trim();
92-
final String regex = "var\\s+?" + item + "=\"([a-zA-Z0-9=?&%_\\-\\.\\/\"\\+: ]+)\";";
92+
final String regex = "var\\s+?" + item + "=\"([a-zA-Z0-9=?&%~_\\-\\.\\/\"\\+: ]+)\";";
9393
final Pattern pattern = Pattern.compile(regex);
9494
final Matcher matcher = pattern.matcher(htmlPage);
9595

0 commit comments

Comments
 (0)
0