Get image url(source) from the Site - java

Today I want to know how to get image URL from webSite,
I already read some questions and answers but they're not quite perfect for me.
The problem is, when I enter the site, there are some images. It's pretty easy that I get image URl by UI, But, it's really hard that I get image URL by Java Servlet and jsp. Sometimes, some image url is in only networks!
For example, http://map.daum.net/ <-- this site.
Enter the site, and see 'RoadView'. When you see Codes in Chrome(F12), there are no image sources in jsp codes. Only you can see in Networks!
How can I get image URL(source)? Is it possible?
ps. I can get image source using mouse and right click, but I want to get image source using java automatically :), so please do not write user's perspective.
ps2. I'm not very well using English, so there are so many mistakes and something like rude. I apologize for that.

So, what you want to do is to scrape a dynamic content of the page to extract some dynamically loaded data (an image url) from it. You did not tell us what programming language or environment you want to use. However, similar questions have been asked before, for instance this one: How to scrape ajax loaded content with jsoup. There are two frameworks named in the answers to this question: PhantomJS and CasperJS. Both are JavaScript frameworks.

Related

how to save the content of an input box on electron locally

I would like the contents of what I put in here to save after I click a save button, how would I go about that? Anything I have tried finding online doesn't answer my question.
https://imgur.com/mUXgsKe
Search for a CRUD application, there're several good tutorials on CRUD apps, this is my favorite:
https://www.youtube.com/watch?v=D67Liy5C86s
And please, node.js/electronjs and javascript are languages totally different from java.

Java Screenshot of multiple webpages

i'm not going to post any code here because i don't know how to start doing it. Actually I need your help...
I am working with java (using netbeans, btw) and I have a database with multiple urls in a table (MySQL), and i want to get a screenshot of every url listed there, save it to my pc and then insert that screenshot (jpeg) in the url table. I was looking here on stackoverflow but i had no answer (not an automatic one, because i have to open a web browser and the aplication is supposed to be a standalone app) (The other option i found in this article -> (this) is unavailable.
In the same article i've read about the Flying Saucer Project, and maybe is the best option, but i have no idea of how to use it and i don't want to waste valious time reading every single thing that the project can do... so i'd appreciate a quick tutorial of how to use it.
Please, if u can post some code here would be great, but at least i'd like an answer of how to do this, or mambe some suggestions, that would be nice too. THANKS EVERYBODY.
You should take a look at CutyCapt:
CutyCapt is a small cross-platform command-line utility to capture WebKit's rendering of a web page into a variety of vector and bitmap formats, including SVG, PDF, PS, PNG, JPEG, TIFF, GIF, and BMP. See IECapt for a similar tool based on Internet Explorer.
Just execute the application from within your Java application. See Running Command Line in Java. The result would be something like::
p = Runtime.getRuntime().exec(String.format("./CutyCapt --url=%s --out=%s",
url, path));

Display external webpage into a webpage in my application

i want to display an external webpage (exactly as it's rendered in that site) into a webpage in my application in a way that's fast and better for SEO crawlers, and i was wondering if there's a way to do that with javaee ?
if not then what is better in performance and for SEO the XMLHTTPRequest way or the iframes way.
please advise with sample code or link if possible, thanks
Update: example website is: http://www.akhbarak.net/
If you need to display content from different pages inline, use iframe (iframe stands for inline frame - it has nothing to do with Apple).
If you'd like to use AJAX to display pages, I would recommend colorbox.
Note that accessing pages in a different domain via AJAX is next to impossible - this is a very, very big security hole. I would not recommend doing it. You would have to use a proxy on your own server to fetch the page and return its HTML.
That said, using the iframe in your source code, so it is loaded with the rest of the page, seems like your best bet. Sites like facebook and twitter use this in embeddable "like" and "tweet" widgets so that those widgets can make requests on their own domain - that is, twitter or facebook. While managing lots of iframes isn't very fun, it is a very accepted way of doing what you want to do.
In theory, you could
load the whole page into a PHP variable,
replace the body tags with ,
take out the html tags,
pull out the entire section and put it in the encompassing pages ,
and replace all links with absolute ones (ie '/images' changes to 'http://example.com/images')
Would it be easy to do? Probably not. It's the only way I can think of to accomplish it so that the site appears as part of yours though.

Securing images used in java applets

I am using a java applet in my web project and some images are shown in this java applet.
I want to limit users to pull images from the web page. What are possible techniques for a client user to save images used in a java applet which is used in a browser session, except "print screen"?
Any ideas are welcome.
Thanks.
..What are possible techniques for a client user to save images used in a java applet
I don't know about typical end-users, but I'd do these things to circumvent several security strategies:
1. Hide them in the archives
Look at the source of the page
Discover the location of the Jars
Download each one by direct fetch
Rename them to .zip and expand them (quick & dirty), then..
Sell your images for causing me that much inconvenience to get them in the form I want.
That last part was sarcasm (mostly), but just wanted to make the point that if you put something in a Jar, people can get it out.
2. Hide them on the server
Use a packet sniffer to discover the image locations by URL.
Pull each image directly (etc.)
3. Encrypt the images
You might use techniques to encrypt the images, then obfuscate the code that decrypts them, but that would also fail against a determined hacker.
4. Screen grab
As mentioned already. 'Last resort' - crude, but effective.
..Any ideas are welcome.
Don't pursue such strategies. You won't achieve any form of security worth having, it will just irritate the user.
If the image is a bitmap inside of a jframe it'll be hard to capture it without resorting to a screen grab. Just like using it in flash the image file itself won't actually exist anywhere on the client.

Linking to images in dynamic webpages

This is a little tricky to explain but I will try.
We have a employee web directory at work that displays the employee photo and their phone extension number etc. Its a dynamic page written in javascript each page has the same layout but obiously the link to the image is always different.
Now what I wanted to do for some fun was to grab those images to use in our continuous build server (this is something people have requested believe it or not), so that when someone breaks the build I can embed their picture in the broken build email. I can generate the web page link to the persons details page but dont know how to grab the image link from that (there is no obvious naming convention) - I dont have access to the network share where the images are stored but do have permission to embed a link to the in the mail if I can figure it out.
Im flexible with the languages I can use I am just curious how to do this task
The web directory must be making an HTTP request for the image at some point. If you can find out what the details of that request are, then you can make an identical request to fetch the image. The "Web Scraping Proxy" logs HTTP request/responses in the form of Perl code. Set it up, navigate through the web directory to the image, and look in the proxy's log.

Categories