pikax / swgoh Goto Github PK
View Code? Open in Web Editor NEWUnofficial node library for swgoh.gg
License: MIT License
Unofficial node library for swgoh.gg
License: MIT License
Getting error:
TypeError: Cannot read property 'nodeValue' of null
at .../node_modules/swgoh/dist/index.cjs.js:330:91
Command to replicate this error:
const username = "ledia";
swgoh.profile(username).then(function (p) {
console.log(p);
})
swgoh.gg adding paging to the character collections. There are currently 3 pages of characters required to get the full response for a character collection.
Example:
https://swgoh.gg/u/pikax/collection/
https://swgoh.gg/u/pikax/collection/?page=2
https://swgoh.gg/u/pikax/collection/?page=3
I'm receiving an error:
TypeError: Cannot read property 'slice' of undefined
at Node.<anonymous> (.../node_modules/swgoh/dist/index.js:287:37)
The line causing the error is:
imageSrc: i$.attr("src").slice(2),
When the ship has 7 stars is parsed as 0*:
{ "code": "slave-i", "description": "Slave I", "imageSrc": "//swgoh.gg/static/img/assets/tex.charui_slave1.png", "star": 0, "level": 85, "crew": [ { "code": "boba-fett", "description": "Boba Fett", "imageSrc": "swgoh.gg/static/img/assets/tex.charui_bobafett.png", "star": 7, "level": 85 } ], "galacticPower": 36946, "maxGalacticPower": 49949 },
Can you add the date and time the swgoh.gg profile was last updated? Thanks!
Hello,
First of all, thanks a lot for the awesome work you did with this package ! :D
I believe it could be very usefull to have at least guild PG coming back from swgoh.guild method.
What do you think ?
Have a great day,
Adrien
Please enhance the profile API to parse out the profile's character name and return it
Line 89 in 04abb46
It is currently populating username with the swgoh.gg user name which is in the top panel. firefox reports the css selector and xpath currently being used to populate the username as follows:
h5.panel-title:nth-child(2) > a:nth-child(1)
/html/body/div[3]/div[2]/div[1]/div[1]/div[2]/h5/a
The character name for the profile can be found in the second panel which has identical markup. firefox reports the css selector and xpath for this character name as follows:
h5.panel-title:nth-child(1) > a:nth-child(1)
/html/body/div[3]/div[2]/div[1]/div[4]/div/div/h5/a
Using your starter code and my SWGOH credentials, I was unable to get my info from swgoh.gg. It seems like a CORS issue when trying to get "https://swgoh.gg/u//":
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Am I missing something completely or is there an issue with the swgoh.profile(username) function call somewhere?
Thanks!
So far I've been using your lbirary by setting the img src attributes to the link that is provided for the toons. For example: https://swgoh.gg/static/img/assets/tex.charui_wampa.png
This link works in the browser but it doesn't work in the application.
I get the following error:
Is there a workaround for this issue? Or alternatively could you pack the static resources (images) to the library so we can reference them locally?
Thanks! And keep up the good work!
Best Regards,
Robert
When entering a username for a mod, I am getting the following error:
Uncaught Promise Error: TypeError: Cannot read property 'startsWith' of undefined
at Swgoh.<anonymous> (/Users/richiegirardin/GitHub/mouse-bot/node_modules/swgoh/dist/index.js:419:34)
at step (/Users/richiegirardin/GitHub/mouse-bot/node_modules/swgoh/dist/index.js:74:23)
at Object.next (/Users/richiegirardin/GitHub/mouse-bot/node_modules/swgoh/dist/index.js:55:53)
at fulfilled (/Users/richiegirardin/GitHub/mouse-bot/node_modules/swgoh/dist/index.js:45:58)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
It used to work before, but does not now.
I've created function to save player's mod into a file:
const swgoh = require("swgoh").swgoh;
const fs = require("fs");
const users = ["xvadrom"];
const saveToFile = name =>
{
swgoh.mods(name).then(info =>
{
fs.writeFile(`./MODS/${name}.json`, JSON.stringify(info)),
function(err) {
if (err) throw err;
};
});
};
users.map(user => saveToFile(user));
I've done it for all members in my guild. But after 3-4 member, another created files are incomplete or empty.
I've noticed that if i change my IP i can download 3-4 more player mods profiles and it starts blocking again.
above u can see that some created files are <200KB or even 1KB (empty) and all of them should be 200KB+
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.