JDownloader Community - Appwork GmbH
 

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 12.10.2017, 06:18
botmtl botmtl is offline
DSL User
 
Join Date: Apr 2015
Location: Montreal
Posts: 39
Default vk.com documents

I'm having some issues with some (but not all vk documents).

example links that don't work:
**External links are only visible to Support Staff****External links are only visible to Support Staff**
**External links are only visible to Support Staff****External links are only visible to Support Staff**
**External links are only visible to Support Staff****External links are only visible to Support Staff**
**External links are only visible to Support Staff****External links are only visible to Support Staff**

document links that do work:
**External links are only visible to Support Staff****External links are only visible to Support Staff**
**External links are only visible to Support Staff****External links are only visible to Support Staff**
**External links are only visible to Support Staff****External links are only visible to Support Staff**

the difference seems to be that the links that don't work have a redirect request (302) to get to the document. no need for a vk account, all 7 links are accessible with direct http.
Reply With Quote
  #2  
Old 12.10.2017, 08:55
botmtl botmtl is offline
DSL User
 
Join Date: Apr 2015
Location: Montreal
Posts: 39
Default

I had a few minutes to spare and I found the problem but I would rather have someone that is good with regular expression make the change him/herself.

First, the problem is in VKontakteRuHoster.

After getting a redirect (line 190), you can either get a TYPE_DOCLINK link (vk.com/doc) or a TYPE_DIRECT link (userapi.com/whatever) as shown in the code below:

VKontakteRuHoster:line 190:
Code:
if (br.getRedirectLocation() != null) {
    if (br.getRedirectLocation().matches(VKontakteRuHoster.TYPE_DOCLINK)) {
        /*not relevant*/
    } else if (br.getRedirectLocation().matches(VKontakteRuHoster.TYPE_DIRECT)) {
        /*not relevant*/
    }
The problem is that the TYPE_DIRECT regex is very restrictive, it will only accept mp3,mp4,zip or rar and nothing else. My example links are all epub documents, that is why the links fail. Reading the documentation at vk.com states that the document section supports
Quote:
the following extensions: doc, docx, xls, xlsx, ppt, pptx, rtf, pdf, png, jpg, gif, psd, djvu, fb2, ps and other formats.
.

I tried to add an mp4, a csproj and a python (.py) file to my "documents section" in my own account and they all worked. I think the reality is that you can get any file type after a redirect and the TYPE_DIRECT regex should allow for any file type. Suggested fix would be something like this?
private static final String TYPE_DIRECT = "https?://(?:c|p)s[a-z0-9\\-]+\\.(?:vk\\.com|userapi\\.com|vk\\.me)/[^<>"]+\\.(?:[A-Za-z0-9]{1,5})(?:.*)";

I suck too bad at regular expression to make the change myself.

I tried the proposed change on my own JD build and it looks like it works well. The problem to testing is that it's hard finding document links that generate a redirect.

General thoughts I had about contributing directly to the project you may want to consider (i'm hoping raz, jiaz or another big head will read this and maybe think about it):
  • I was thinking you would maybe get more contributions from outsiders like me if you were using git for source control instead of svn.
  • It's very scary making a change to a live project and knowing you may be breaking a plugin. You have to be very sure of yourself and the change you are making.
  • JD is a very complex piece of software, and an outsider's understanding it very limited.
  • If you were using git instead of svn for outsider-contributors like me, I would not hesitate making a contribution (called a pull request in git terms) because I know it wont be effective until someone accepts the change/contribution or rejects it.
  • That is very reassuring. Plus it doesn't take much time on the part of the core developers. I think all the core developers would see at a glance if the proposed change makes sense or breaks something.
  • Also, to avoid history repeating itself... You would not have been slapped by that idiotic judge 10 years ago if contributions from outsiders needed to be accepted/rejected by a core developer.
  • Ok that's it, just something to think about.

Last edited by botmtl; 12.10.2017 at 08:59.
Reply With Quote
  #3  
Old 12.10.2017, 12:39
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,286
Default

I've updated the pattern as suggested by you.
If you wish to contribute and modify code yourself, just contact us via support@jdownloader.org.
There are advantages and disadvantages of svn vs git. At the moment there are no plans to change to git because our complete build/deployment system is build on svn + git doesnt support (as far as I know) permissions/hidden folders and such stuff.
__________________
JD-Dev & Server-Admin

Last edited by Jiaz; 12.10.2017 at 12:41.
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:29.
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 - 2024, Jelsoft Enterprises Ltd.