JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #1  
Old 14.10.2015, 13:52
Stepel
Guest
 
Posts: n/a
Default JDownloader in my Application

Hi,

I would like to create simple application in Java which checks link status (if it is active or not). Where I can find information about it ?

Can I use only some classes from JDownloader to do it ?

Thanks for answers.
Greetings
Reply With Quote
  #2  
Old 14.10.2015, 14:18
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 82,997
Default

I'm sorry but "simple" is not that "simple" If you want to use JDownloader plugin code then there is a lot of stuff you need to change or rewrite or use. I guess it is much simpler to write code on your own and just look how it is done in JDownloader.
You can use classes from JDownloader Project, AppworkUtils only as a library.
__________________
JD-Dev & Server-Admin
Reply With Quote
  #3  
Old 14.10.2015, 14:18
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 82,997
Default

The needed information you can find within the Plugin Class itself. eg
jd.plugins.hoster.Uploadedto, the requestFileInformation method
__________________
JD-Dev & Server-Admin
Reply With Quote
  #4  
Old 18.10.2015, 22:48
Stepel
Guest
 
Posts: n/a
Default

is there no something simple like

LinkChecker lC = new LinkChecker();
lC.check("www....") ?

or maybe I can use
LinkCollector
.getInstance()
.addCrawlerJob(.......) ?

I just want to know if link is online or offline..nothing more ;/
Reply With Quote
  #5  
Old 19.10.2015, 13:50
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 82,997
Default

Yes, that would work but you will need nearly all JDownloader source for that
In that case you could simply use an existing JDownloader and use the remote api and do whatever you want to do and still receive all the updates from us
__________________
JD-Dev & Server-Admin
Reply With Quote
  #6  
Old 19.10.2015, 20:38
Stepel
Guest
 
Posts: n/a
Default

Hmm where I can find documentation for remote api ?
Only what I want to check is if link is online or offline but i have a lot of links to check
Is there any limit for using remote API ?
Reply With Quote
  #7  
Old 20.10.2015, 09:37
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 82,997
Default

API, see here https://support.jdownloader.org/inde...erorg-api-docu
There is no limit.

There are existing clients for MyJDownloader in Java/JS/php....
__________________
JD-Dev & Server-Admin
Reply With Quote
  #8  
Old 20.10.2015, 22:50
Stepel
Guest
 
Posts: n/a
Default

Hm OK but I don't undertand where is Java/JS/php.. ?

I have installed J2DBeta and created account. But on what local address does service work ?
I saw in the Internet some PHP classess for API.
I think that for me would be the best solution do it in PHP
Reply With Quote
  #9  
Old 21.10.2015, 09:35
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 82,997
Default

Java Client is svn://svn.jdownloader.org/jdownloader/MyJDownloaderClient
JS, I can give you if you need it.
php, google for it
There is no local address. You either use the tunnel mode via api.jdownloader.org or establish a direct connection to your JDownloader and then use ip:port combination that got established
__________________
JD-Dev & Server-Admin
Reply With Quote
  #10  
Old 21.10.2015, 12:06
Stepel
Guest
 
Posts: n/a
Default

If I would like to establish a direct connection, What I have to do ?
I can't find settings where I can set PORT or IP.
I have a lot of links to check so I tihnk that tunnel via api.jdownloader.org is not the best Idea.
Reply With Quote
  #11  
Old 21.10.2015, 12:35
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 82,997
Default

You use api.jdownloader.org and then use the command to establish a direct connection
then you can directly speak to your JDownloader instance.

You can enable the "Deprecated API" in advanced settings in JDownloader, then you can access all api commands Without Encryption/Authentication.
__________________
JD-Dev & Server-Admin
Reply With Quote
  #12  
Old 21.10.2015, 21:27
Stepel
Guest
 
Posts: n/a
Default

So can't I set direct connection to my JDownloader instance using options (advenced) in JDownloader ?
I see there Connect IP, port etc

Last edited by Stepel; 21.10.2015 at 21:40.
Reply With Quote
  #13  
Old 22.10.2015, 08:32
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 82,997
Default

Yes you can...I already descibed it.....First you login at api.jdownloader.org and then ask your jdownloader for direct connection mode and then you can connect directly

OR

you enable the "deprecated api" in advanced settings and bypass myjdownloader and be able to use the api directly without any encryption/authentication at all
__________________
JD-Dev & Server-Admin
Reply With Quote
  #14  
Old 22.10.2015, 21:40
Stepel
Guest
 
Posts: n/a
Default

What is appkey parameter ?
I checked one class for php, I connect and add Link and i get response with token etc..but nothing new in my linkgrabber..


I've noticed that i Have response from "connect" but addLink returns FALSE :/

Last edited by Stepel; 23.10.2015 at 00:07.
Reply With Quote
  #15  
Old 23.10.2015, 09:04
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 82,997
Default

I think best would be to join chat so we can talk live about this (irc, freenode, #jdteam)
appkey = use your email so we can contact you in case we need to
__________________
JD-Dev & Server-Admin
Reply With Quote
  #16  
Old 25.10.2015, 01:03
Stepel
Guest
 
Posts: n/a
Default

Hi,

what response should I get from method AddLinks ?
I add link via API from PHP but I get

url= http://api.jdownloader.org/t_78a652f...berv2/addLinks

response= { "rid" : 1445726889, "data" : "" }

data is empty ?

I need to get information about LINK_AVALIABLE ? Is there method which return list of Lingrabber List ?
I can't find in documentation :(
Reply With Quote
  #17  
Old 25.10.2015, 09:10
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 82,997
Default

Hi,
There is no single method way
You need to do
1.) add links
2.) get linkcollector list when crawling / checking is finished

This is because the whole crawling/checking is multithreaded and the api cannot wait till everything is done (timeout), that's why you have to poll for results or listen to event channel

There is no checklink(url) because an url can also lead to multiple results + multithreaded from above.

addLinks has no response in error free
__________________
JD-Dev & Server-Admin
Reply With Quote
  #18  
Old 25.10.2015, 10:32
Stepel
Guest
 
Posts: n/a
Default

Yes I know that there is no checklink(url)
but is there method to get linkcollector list ? There should be information about status like in JD2.
I don't want even download file.
I see that if I paste(or add by API) properly link status is ONLINE else OFFLINE so it works as I want.
Reply With Quote
  #19  
Old 25.10.2015, 13:04
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 82,997
Default

Yes there is, see the api doc for querylinks. I guess the php client was first work with just 1,2 example methods. you will have to add the addtional methods yourself. Contact us in chat between Mo-Fr if you need help with that.
__________________
JD-Dev & Server-Admin
Reply With Quote
  #20  
Old 28.10.2015, 23:40
Stepel
Guest
 
Posts: n/a
Default

Hi, what i should send when I want removeLink ?
WHat is ID of link ? it is uuid ana packageUUID from response from queryLink ?
Reply With Quote
  #21  
Old 29.10.2015, 11:30
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 82,997
Default

packageUUID is the UUID from the package
each link has its own UUID
you can either remove the complete package or single links
__________________
JD-Dev & Server-Admin
Reply With Quote
  #22  
Old 29.10.2015, 14:47
Stepel
Guest
 
Posts: n/a
Default

Are both fields mandatory ? I haven't seen in Java code that those parameters have defalut values.
Reply With Quote
  #23  
Old 29.10.2015, 15:04
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 82,997
Default

no, they are not, leave them empty (not null)
when you provide a packageUUID -> you want to delete all children from package
in case you only want some links, provide their linkUUIDs
__________________
JD-Dev & Server-Admin
Reply With Quote
  #24  
Old 29.10.2015, 23:32
Stepel
Guest
 
Posts: n/a
Default

Should it be sth like that (just example):

{"url":"/linkgrabberv2/removeLinks","links":["{}"],"packages":["{1446157638919}"],"rid":1446157644,"apiVer":1}
?
Reply With Quote
  #25  
Old 30.10.2015, 09:04
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 82,997
Default

no,the parameters are not named. they are not key/value!
parameters are given in an json array!
["string",-1,{Object}]
__________________
JD-Dev & Server-Admin
Reply With Quote
  #26  
Old 01.11.2015, 21:09
Stepel
Guest
 
Posts: n/a
Default

Ok thanks, in PHP it should look like

$json_data = '{"url":"'.$action.'","params":[['.$links.'],['.$packages.']],"rid":'.$this -> getUniqueRid().',"apiVer":'.$this -> apiVer.'}';

it works as I want

Now I have to connect directly to my JDonwloader instance
Reply With Quote
  #27  
Old 02.11.2015, 14:48
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 82,997
Default

@Stepel: Thanks for the feedback
For direct connection. Query /device/getDirectConnectionInfos
it will return a list of IP/PORT pairs you can try to connect
simply replace api.jdownloader.org with IP/PORT when doing a request to JDownloader
for server commands keep api.jdownloader.org
you can use /device/ping command for simple connection testing
__________________
JD-Dev & Server-Admin
Reply With Quote
  #28  
Old 02.11.2015, 22:17
Stepel
Guest
 
Posts: n/a
Default

What do you mean by "Query /device/getDirectConnectionInfos
it will return a list of IP/PORT pairs you can try to connect" ?

Is it enugh to change api.jdownloader.org in advance settings ?
What I should set more ?
Reply With Quote
  #29  
Old 03.11.2015, 10:28
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 82,997
Default

You call the command /device/getDirectConnectionInfos on the device(your JDownloader)
the answer contains a list of IP/PORT
Then you can use
IP:PORT instead of api.jdownloader.org and use the command /device/ping if the connection works
if yes, use the IP:PORT for all further device requests
if no, try next IP:PORT and check again

you simply exchange api.jdownloader.org with the IP:PORT that works, nothing more, nothing less
__________________
JD-Dev & Server-Admin

Last edited by raztoki; 03.11.2015 at 11:07. Reason: disable smiles
Reply With Quote
  #30  
Old 03.11.2015, 22:57
Stepel
Guest
 
Posts: n/a
Default

Hm Have I to change only in my php class or in advance settings?
If I want to try at home i think i have to set port forwarding on my router :/

response= { "rid" : 1446587609, "data" : { "infos" : [ { "port" : 46487, "ip" : "192.168.1.3" }, { "port" : 46487, "ip" : "127.0.0.1" } ] } }

This is what i got.
Reply With Quote
  #31  
Old 04.11.2015, 13:43
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 82,997
Default

you have to update php client and add support to use
ip:port from list when sending commands to your device
by default it uses api.jdownloader.org
you will have to modify code to use ip:port instead

You only need to enable upnp/port forwarding if you want to use direct-mode outside your wlan/lan
__________________
JD-Dev & Server-Admin
Reply With Quote
  #32  
Old 05.11.2015, 20:19
Stepel
Guest
 
Posts: n/a
Default

Something doesn't work.
I have pure linux with jd2 and public ip.
getDirectConnectionInfos returns me IP and PORT.
Should I have to be connected to my.jownloader.org in my instance or not ?

In PHP I have private $api_url = "http://api.jdownloader.org";
Are you suggesting to change it to private $api_url = "http://IP:PORT"; o without http ?
What about advanced settings in my jd2 instance ? Should I change something there ?

Last edited by raztoki; 06.11.2015 at 10:08. Reason: disabled smilies & spelling fixes
Reply With Quote
  #33  
Old 06.11.2015, 10:04
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 82,997
Default

With a valid IP:Port from getDirectConnectionInfos

you simply use
$api_url = "http://api.jdownloader.org"
for all commands that are server side (eg account stuff)
and
$api_url = "http://IP:PORT";
for all commands that are jdownloader side
__________________
JD-Dev & Server-Admin

Last edited by raztoki; 06.11.2015 at 10:06. Reason: disabled smilies
Reply With Quote
  #34  
Old 06.11.2015, 10:35
Stepel
Guest
 
Posts: n/a
Default

Do I have to be connected to my.jdownloader.org in my instancje or not ?
What about advanced settings in my jd2 instance ? Should I change something there ?
Reply With Quote
  #35  
Old 06.11.2015, 11:04
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 82,997
Default

Nothing to change in advanced settings

my.jdownloader.org is just a simple webclient for the api

it is api.jdownloader.org

you first login there to get your session/token and then call your device for getDirectConnectionInfos
and then can use IP:PORT for all further requests to your device.
__________________
JD-Dev & Server-Admin
Reply With Quote
  #36  
Old 06.11.2015, 21:39
Stepel
Guest
 
Posts: n/a
Default

Sth doesn't work :(
Should I see something if I open http://IP:PORT in browser?
Reply With Quote
  #37  
Old 07.11.2015, 08:22
Stepel
Guest
 
Posts: n/a
Default

I don't understand something.
Why I should connect first to api.jdownloader.org ?
I thought that my JD2 instance is my "server" when I use direct connection..
Reply With Quote
  #38  
Old 08.11.2015, 21:15
Stepel
Guest
 
Posts: n/a
Default

Don't I need Tomcat or sth ?
Reply With Quote
  #39  
Old 09.11.2015, 10:12
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 82,997
Default

No, you should NOT see anything when you simply open IP:PORT in browser.
You first connect to api.jdownloader.org to get a session, authenticate yourself to your JDownloader. Then query connection infos via getDirectConnectionInfos and then can directly connect to your JDownloader via the authenticated session.

And no, why should you need an additional webserver? You connect to JDownloader
__________________
JD-Dev & Server-Admin
Reply With Quote
  #40  
Old 09.11.2015, 10:53
Stepel
Guest
 
Posts: n/a
Default

I am just asking because I don't understand why it doesn't work :(
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +2. The time now is 20:18.
Provided By AppWork GmbH | Privacy | Imprint
Parts of the Design are used from Kirsch designed by Andrew & Austin
Powered by vBulletin® Version 3.8.10 Beta 1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.