Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro-cn-database-generator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
ygopro-cn-database-generator
Commits
4d1643aa
Commit
4d1643aa
authored
Oct 20, 2020
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shortens
parent
c83061bd
Pipeline
#938
passed with stages
in 1 minute and 27 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
run.ts
run.ts
+1
-8
src/nwfetcher.ts
src/nwfetcher.ts
+7
-0
No files found.
run.ts
View file @
4d1643aa
...
@@ -2,17 +2,10 @@ import { DBReader } from "./src/dbreader";
...
@@ -2,17 +2,10 @@ import { DBReader } from "./src/dbreader";
import
{
NWFetcher
}
from
"
./src/nwfetcher
"
;
import
{
NWFetcher
}
from
"
./src/nwfetcher
"
;
import
_
from
"
underscore
"
;
import
_
from
"
underscore
"
;
async
function
fetchCardsFromNW
(
dbreader
:
DBReader
)
{
const
fetcher
=
new
NWFetcher
({
name
:
"
NW Fetcher
"
,
level
:
"
debug
"
});
await
fetcher
.
init
();
const
strings
=
await
fetcher
.
fetch
();
return
await
dbreader
.
getAllCardsFromJapaneseNames
(
strings
);
}
async
function
main
()
{
async
function
main
()
{
const
dbreader
=
new
DBReader
({
name
:
"
Database
"
,
level
:
"
debug
"
});
const
dbreader
=
new
DBReader
({
name
:
"
Database
"
,
level
:
"
debug
"
});
await
dbreader
.
init
();
await
dbreader
.
init
();
const
cards
=
await
fetchCardsFromNW
(
dbreader
);
const
cards
=
await
NWFetcher
.
fetchOnce
(
dbreader
);
await
dbreader
.
run
(
cards
);
await
dbreader
.
run
(
cards
);
process
.
exit
();
process
.
exit
();
}
}
...
...
src/nwfetcher.ts
View file @
4d1643aa
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
import
axios
from
"
axios
"
;
import
axios
from
"
axios
"
;
import
_
from
"
underscore
"
;
import
_
from
"
underscore
"
;
import
Base
from
"
./base
"
;
import
Base
from
"
./base
"
;
import
{
DBReader
}
from
"
./dbreader
"
;
function
convertCharToFullSize
(
char
:
string
)
{
function
convertCharToFullSize
(
char
:
string
)
{
...
@@ -14,6 +15,12 @@ function convertCharToFullSize(char: string) {
...
@@ -14,6 +15,12 @@ function convertCharToFullSize(char: string) {
}
}
export
class
NWFetcher
extends
Base
{
export
class
NWFetcher
extends
Base
{
static
async
fetchOnce
(
dbreader
:
DBReader
)
{
const
fetcher
=
new
NWFetcher
({
name
:
"
Temp NW Fetcher
"
});
await
fetcher
.
init
();
const
strings
=
await
fetcher
.
fetch
();
return
await
dbreader
.
getAllCardsFromJapaneseNames
(
strings
);
}
private
async
fetchPage
(
url
:
string
):
Promise
<
string
>
{
private
async
fetchPage
(
url
:
string
):
Promise
<
string
>
{
this
.
log
.
debug
(
`Downloading content from
${
url
}
.`
);
this
.
log
.
debug
(
`Downloading content from
${
url
}
.`
);
const
{
data
}
=
await
axios
.
get
(
url
,
{
const
{
data
}
=
await
axios
.
get
(
url
,
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment