evgeniy Posted November 15, 2013 Report Share Posted November 15, 2013 (edited) URL1 = http://www.sciencedirect.com/science/article/pii/S0370269312012476 URL2 = http://www.sciencedirect.com/science/article/pii/S0370269312012476/pdfft?md5=9a730e81d51a8454c214d70db9bd5a37&pid=1-s2.0-S0370269312012476-main.pdf URL3 = http://ac.els-cdn.com/S0370269312012476/1-s2.0-S0370269312012476-main.pdf?_tid=d2ec0938-4e17-11e3-ba25-00000aacb362&acdnat=1384535178_da8b42f199f76760c720b1f971beb303 napisao sam neko programce kojim pokusavam da skinem neke PDF-ove sa neta, ali imam problem sa jebenim pop-up prozorima. na primer, na ovoj strani (URL1), "Download PDF" vodi ka URL2, ali potom korisniku otvara pop-up i redirektuje na URL3 odakle se uredno vidi PDF. kada gadjam URL2 i trazim response code, dobijam 301. to bi dakle trebalo da znaci da bi "Location" u Headeru trebao da vrati URL3, ali jok, on vraca URL1 (sto je i ocekivano jer se Location ne menja, vec se otvara pop-up koji otvara PDF). taj pop-up ocigledno otvara javascript, al' nema sanse da navatam kako/gde, barem za sad. moje pitanje je: da li je izvodljivo da java ikako procita taj novi URL iz pop-upa na kome se stvarno nalazi PDF ili jok? ne treba mi resenje, samo savet u kom bih otprilike pravcu trebao da razmisljam jer mi ovo vec duze vreme ide na polni organ, jelte. kako bi neko ko nije priucen java wannabe programer pristupio resavanju ovog govno problema? btw, u trenutku kada citate post, URL3 verovatno nece postojati, jer se generise novi nakon nekog vremena. btw2, kada pokusam da skinem PDF sa URL3 adrese, sve lepo radi. dakle, problem mi je samo kako iskopati taj prokleti URL iz pop-upa. btw3, posto za GUI koristim JavaFX, mislio sam da cu moci WebView-om da emuliram browser, pa kada se otvori pop-up da procitam URL, ali kurac. pop-up se ne otvara uopste. help a nigga out =c Edited November 15, 2013 by digrejzö Quote Link to comment Share on other sites More sharing options...
evgeniy Posted November 15, 2013 Author Report Share Posted November 15, 2013 (edited) evo ga i source. radi lakseg snalazenja, ovo o cemu sam pricao je u src/core/fileDownloader.java. Edited November 15, 2013 by digrejzö Quote Link to comment Share on other sites More sharing options...
Junkie Posted November 15, 2013 Report Share Posted November 15, 2013 ako kliknes na linku open in new tab ne otvara kao popup.. ima neki redirect na samom tom linku, ne mogu da stignem da kliknem view source tako brzo da vidim o cemu se radi Quote Link to comment Share on other sites More sharing options...
evgeniy Posted November 15, 2013 Author Report Share Posted November 15, 2013 da da, to vec znam. fora je sto ne mogu da uhvatim taj link na kojoj se nalazi pdf pre nego sto "otvorim" stranu sa pdf-om. a meni bas to treba, da unapred znam gde ce da me redirektuje kako bih programu rekao odakle da skida pdf fajl =) Quote Link to comment Share on other sites More sharing options...
Junkie Posted November 15, 2013 Report Share Posted November 15, 2013 el ti ovo pomaze? Quote Link to comment Share on other sites More sharing options...
evgeniy Posted November 15, 2013 Author Report Share Posted November 15, 2013 (edited) jos samo da skontam kako da iscupam to govance u javi =) edit: je l' te podatke cupas sa strane samog clanka? ili ipak onog "Download PDF" linka? Edited November 15, 2013 by digrejzö Quote Link to comment Share on other sites More sharing options...
Junkie Posted November 15, 2013 Report Share Posted November 15, 2013 (edited) http://www.mkyong.com/java/how-to-get-http-response-header-in-java/ http://stackoverflow.com/questions/2307291/getting-raw-http-response-headers da se ogradim, nemam nikakvog iskustva sa cistom javom, samo JS,JQuery itd ako ti ni tako ne radi, moguce da moras da prosledis cookije za autentikaciju da bi ti vratio ispravan header, koje mi se cini isto periodicno randomizuju/obnavljaju, nisam gledao koliki im je expire .. posto vidim da je tebi bacao 301, a iz browsera baca 302 .. jbt al su nabili tih stvari za sajt ko da ne znam sta drze na njemu... worst case scenario: -lupis neki request prvo gde ce ti vratiti auth cookie i store u var -das request na link sa autentikacijom, pokupis response header i tu varijablu -ako planiras da pustas duze da radi ili dodaj interni tajmer kad radi pauza-refresh cookija-resume sa novim vrednostima, ili da proverava dal je dobio 302, pa ako nije da trazi nov cookie.. bah.. edit: nisam video tvoj edit :P skini fiddler , olaksace ti zivot oko tih gluposti.. upalim njega, kliknem na link i vidim kuda vuce.. ima 2 koraka izmedju, mislim da su neke inject skripte za gluposti, nema veze sa pdf-om Edited November 15, 2013 by Junkie 1 Quote Link to comment Share on other sites More sharing options...
evgeniy Posted November 15, 2013 Author Report Share Posted November 15, 2013 pa ono, nije da ne drze. taj ScienceDirect ima prilicno zajebanu bazu naucnih clanaka (ScienceDirect is website operated by the Anglo-Dutch publisher Elsevier containing (as of 2013) about 11 million articles from 2,500 journals and 6,000 e-books, reference works, book series and handbooks.). ovaj jedan clanak koji sam linkovao ovde je nekim cudom besplatan i svi mogu da ga vide, ostale clanke mozes da vidis samo iz biblioteke. cena clanaka ume da bude paprena, pa su se ocigledno zato iscimali i stavljali sve ovo =) btw, hvala Dzanki! sad cu da probam da iscackam nesto, pa javljam sta sam uradio, ako ikoga zabole =D Quote Link to comment Share on other sites More sharing options...
Junkie Posted November 15, 2013 Report Share Posted November 15, 2013 aha.. my bad , nisam se zadubljivao.. ako mislis da po tom 1 napravis downloader da sve svuces.. nece ti sljakati.. jer moras da prosledis login cookie koji je validan za taj url u suprotnom ce da te sutne napolje a kad sam probao da nesto kupim od clanaka pise ovo ispod You will have immediate online access to purchased articles for a 24 hour period following the completion of this purchase. During this 24 hour period, you may download and print a copy of each article for your personal use. aka cak i user dobije ogranicen pristup, dal mu drze link validan toliko ili mu ubace cookie kad klikne na njega.. pocinjem da se divim liku koji je imao zivaca da isprogramira taj lvl paranoje http://www.youtube.com/watch?v=MY5PkidV1cM Quote Link to comment Share on other sites More sharing options...
evgeniy Posted November 15, 2013 Author Report Share Posted November 15, 2013 procitaj pm, bice ti jasnije =) Quote Link to comment Share on other sites More sharing options...
evgeniy Posted November 20, 2013 Author Report Share Posted November 20, 2013 (edited) 5 dana kasnije, uspeo sam da resim ovo sranje. u sustini, resenje mi je svih 5 dana bilo ispred nosa jer ne citam kako treba =( Edited November 20, 2013 by digrejzö Quote Link to comment Share on other sites More sharing options...
Junkie Posted November 21, 2013 Report Share Posted November 21, 2013 facepalm trenutak kad shvatis posle X dana konstruisanja nove funkcije, da vec postoji mi je poznat :) Quote Link to comment Share on other sites More sharing options...
peja_ Posted November 21, 2013 Report Share Posted November 21, 2013 priuceni, a Quote The thing's hollow — it goes on forever — and — oh my God — it's full of stars! Link to comment Share on other sites More sharing options...
evgeniy Posted November 21, 2013 Author Report Share Posted November 21, 2013 =c Quote Link to comment Share on other sites More sharing options...
Trooper Posted November 21, 2013 Report Share Posted November 21, 2013 nemam nikakvog iskustva sa cistom javom, samo JSposto su Java i JS slicni. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.