Choosing only a selection of String from BufferReader/downloading images

I'm trying to write a program to download images from a webpage (basically it's a slide show, with links to the next/previous photo).. I am trying to automate it so that it will automatically load the next link, download the next image, until there are no more.. I haven't been able to find anything on how to download an image (jpg) to my computer.. and then I'm trying to figure out how to scan through the source code of the webpage, and choose only a selection of it (the link for the next page)..
For example, I'm trying to do this on this http://screenshots.teamxbox.com/screen/81845/XBlades/
Here's what I have so far--
import java.net.*;
import java.io.*;
import java.util.*;
public class Images {
    public static void main(String[] args) throws Exception {
         Scanner input = new Scanner(System.in);
         System.out.print("URL: ");
         String inUrl = input.nextLine();
    URL link = new URL(inUrl);
     BufferedReader in = new BufferedReader(
                    new InputStreamReader(
                    link.openStream()));
     String inputLine;
     while ((inputLine = in.readLine()) != null)
          if(inputLine.contains("http://media.teamxbox.com/games/ss/")){
             System.out.println("Photo Exists");
          in.close();
}If anyone could steer me into the right direction, it would be GREATLY appreciated. Thanks a lot!
I am willing to pay anyone who can help me figure it out.
-Reidypea

DrClap wrote:
reidypea wrote:
I didn't even do anything really.Yeah, I guess that's part of the problem.
Okay, let's take your original code. What's it supposed to be doing? Reading HTML from a web page? And you want to extract all the references to images in that HTML and do something with each of them? Okay. Then you need to parse the HTML and look for <img> tags and other HTML elements that refer to images. Extract the URL for each image. Probably it will be a relative URL, so you have to make that into an absolute URL based on what you used in the first place.
To download an image you use code much like what you have there, only you don't use a Reader because an image isn't text. Just use an InputStream by itself. You'll also have to look at the Content-type header to determine what type of image it is.
That should get you started. If you think it's too much work (and yeah, there's a lot of details to iron out there) then by all means go to one of the sites mentioned earlier to contract it out. But don't just mope around here pestering people to do it for you. Way too much work for a freebie.Thanks a lot man, I appreciate it

Similar Messages

  • Is there any difference , selecting particular string from left to right

    hi
    we have a problem for selecting a string ...
    we selecting a string from JEditorPane ..
    useing JEditorPane.getselectedText();
    After selecting text we adding some tags to selected text
    it working fine when we are selecting from right to left .
    when we are selecting text left to right it's not working .but
    we geting selected text in both times(right to left, left to right) ..
    pls help very urgent

    I can only guess... But if it is true that you mean by 'selecting right to left' that the selection started at the right and ended on the left. Perhaps you are storing values from JEditorPane.getSelectionStart() and JEditorPane.getSelectionEnd(). If this is true, it could mean the failure you have in your code, because the number for getSelectionStart() is higher then getSelectionEnd() if you started from right and lower when you started from left. That could cause your problem.
    You could fix this for example by this:
    if (MyEditorPane.getSelectionEnd()<getSelectionStart())
    change values.
    or vice versa, hope that helps...

  • Only migrate select files/apps from TM to new iMac?

    I'm getting a new intel iMac in a few days and would prefer to just do a fresh startup with it and be able to pick and choose which files and applications I want to transfer to the new iMac from Time Machine. Is this possible? I've searched, but only found information about doing a complete migration from TM and nothing about only migrating certain things over.

    I recently did just the same thing, but I simply migrated everything so I do not know if it's possible to pick and choose, however, it may well be.
    On the other hand, you can always just migrate everything and then uninstall or delete what you don't need after the new Mac is up and running.
    One caveat: Be sure to deauthorize iTunes on your old Mac before the switchover, and deactivate Adobe apps if you have them, then reauthorize and/reactivate from the new Mac.
    I made sure all my apps and system were completely updated before migrating. Worked seamlessly.

  • Selecting a string from Jlist

    Hi guys, I am trying to search a list for a string, then if there is no string in the list that matches my search,i want to add a new string to the list..
    here is my code, but tmp is not getting any value...
    int j = 0;
    String tn,tmp;
           while (result.next())
                             j++;
                             tn = result.getString("UserResponsible");
                             for(int f = 0;f<j;f++)
                                  uList.setSelectedIndex(f);
                                  String tmp = new String(uList.getSelectedValue().toString());
                                  if(tn.compareTo(tmp)== 0)
                                       uModel.addElement(tn);
                                       utwoModel.addElement(tn);     
                             x = uModel.getSize();          
                             y =utwoModel.getSize();
                        }     

    sorry i dont know what i pressed and i posted up three questions by accident

  • STARTED IT, BUT STILL NEED HELP -- INPUTTTING CHARACTERS FROM LOADED FILE INTO TABLE, SELECTING STRINGS FROM TABLE AND PLACING IN NEW TABLE, SAVING NEW TABLE TO SPREADSHEET FILE

    I AM TRYING TO IMPORT CHARACTERS FROM A TAB DELIMITED FILE INTO A TABLE ON LABVIEW.  ONCE THE DATA IS IN THE TABLE I WANT TO BE ABLE TO SELECT INDIVIDUAL STRINGS FROM THE TABLE AND PLACE IT IN A NEW TABLE.  WHEN I CLICK ON A STRING I WOULD LIKE THE SELECTED STRING TO SHOW IN A TEXT BOX LABELED 'SELECTED STEP'  AFTER ALL THE SELECTED STRINGS IS IN THE TABLE I WOULD LIKE TO SAVE THE NEW TABLE AS ANOTHER SPREADSHEET -- TAB DELIMITED -- FILE, MAKING IT ACCESSIBLE TO OPEN.  HERE IS WHAT I HAVE SO FAR.  I CAN INPUT DATA INTO THE TABLE, BUT I CAN ONLY TRANSFER ONE STRING INTO THE TABLE I WOULD LIKE TO BE TO INPUT MULTIPLE STRINGS.    ALSO WHENEVER I TRY SAVING THE FILE, IT ALWAYS SAVES A UNKNOWN FILE, HOW CAN I GET IT TO SAVE AS A SPREADSHEET FILE.  THANKING ALL OF YOU IN ADVANCE FOR YOUR HELP!!!!!!
    Attachments:
    Selector.zip ‏30 KB

    Pondered,
       The question you are asking is the same one that you asked in: http://forums.ni.com/ni/board/message?board.id=170&message.id=132508#M132508, to which I supplied a revised version of the original vi you used (which was modified from the original one I supplied to an earlier thread). A couple of questions: 1) What does my latest not do that is in your question, 2) Why are you starting yet another thread about the same problem?  We are here trying to help, it makes it a lot easier if you keep the same problem in the same thread, it reduces duplication of effort from those that might not have been following the previous thread(s).  Those of us that don't have our "names in blue" are just doing this "for fun" (the blue names are NI employees, who may still be doing it "for fun"), and it makes it more fun if it doesn't seem (correctly or not) that our attempts are ignored.  If an answer doesn't help, or seems incomplete, post a little more detail to the same thread so that the original respondent, or someone new, can provide more information, or understand your problem better.
    P.M.
    Message Edited by LV_Pro on 07-20-2005 01:20 PM
    Putnam
    Certified LabVIEW Developer
    Senior Test Engineer
    Currently using LV 6.1-LabVIEW 2012, RT8.5
    LabVIEW Champion

  • Get only strings from Varchar2 Column

    Hi,
    How can I extract only strings form varchar2 type column?
    I have data like below.
    25-Abc xy
    233-xyz jj
    x23A
    9-dd
    5-aaa(pp)
    I need following outputs (- also be removed)
    Abc xy
    xyz jj
    xA
    dd
    aaa(pp)
    Thanks,
    Sujnan

    Maybe...
    API> WITH t AS (SELECT '25-Abc xy' AS col FROM DUAL
      2          UNION
      3          SELECT '233-xyz jj' FROM DUAL
      4          UNION
      5          SELECT 'x23A'  FROM DUAL
      6          UNION
      7          SELECT '9-dd'  FROM DUAL
      8          UNION
      9          SELECT '5-aaa(pp)'  FROM DUAL)
    10    SELECT TRANSLATE(col, '1234567890-', ' ') AS RES
    11    FROM t;
    RES
    xyz jj
    Abc xy
    aaa(pp)
    dd
    xA
    Transcurrido: 00:00:00.93

  • HT5824 Can I use only one (selected) folder from my documents in iCloud?

    Can I use only one (selected) folder from my documents in iCloud for MAC and PC?

    If the folders were created in the Photos app on the iPad, they don't really contain copies of the photos. They contain pointers to those photos that allow them to appear in the albums that you create. Consequently, they cannot be imported to the computer. Those albums are for local organization on the iPad only And cannot be imported.
    You should be able to select the indicidual phots that you want to import, as far as I know. I can do it on a Mac using iPhoto or Image Capture, so I assume that Windows will allow you to pick and choose which photos you want to import.
    Import photos and videos from your iPhone, iPad, or iPod touch to your Mac or Windows PC - Apple Support

  • I would select a link from the drop down on the address bar but the page would not open. I would select it again but the page does not open. I could only reach website by selecting google on most visited list.

    After updating AVG anti-virus, I encountered a problem on Firefox. I would select a link from the drop down on the address bar but the page would not open after clicking on it. I would select it again, even double click, but the page does not open. I could only reach website by selecting google or yahoo from my dropdown on the most visited list and then click the website that I want to visit. I would like to do this in one step by just selecting a link from my history on the address bar and select a link instead of going to google and then writing the page I want to visit. What could be the problem? When going to the address bar to select a link to open, why does the site not open? Any help would be appreciated.

    Hi,
    Please check if this happens in [https://support.mozilla.com/en-US/kb/Safe%20Mode Safe Mode.]
    [http://kb.mozillazine.org/Problematic_extensions Problematic Extensions]
    [https://support.mozilla.com/en-US/kb/Troubleshooting%20extensions%20and%20themes Troubleshooting Extensions and Themes]
    [http://support.mozilla.com/en-US/kb/Uninstalling+add-ons Uninstalling Add-ons]
    [http://kb.mozillazine.org/Uninstalling_toolbars Uninstalling Toolbars]

  • How to get only selected table columns from a DB table to be display in pag

    hi i have some 18 columns in my database table, but i need to add only the selected columns to be added to my table component. How can i do it. any idea regarding this. Please help me out to solve this problem.
    Thank You in Adavnce.

    This is an ambiguous question but I will give 2 answers for 2 interpretations
    1 In the Outline window, right-click the rowset in the Session bean (or whatever bean you put the rowset in, by default it is the session bean). In the top pane, select or clear the checkboxes to determine which columns are obtained by the query.
    2 Right click the Table component and choose Table Layout, move the columns you don't want to the left panel
    Resources: http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/databoundcomponents.html
    If you meant a different question, please clarify

  • How to make users to select the date from calendar control my making the date field read only in date time control in external list in sharepoint 2010

    How to make users to select the date from calendar control only, by my making the date text field read only (don't want to let users type the date) in date time control in external list in sharepoint 2010. I am looking for a solution which can
    be done through sharepoint desginer / out of the box.
    thanks.

    Congratulate you got the solution by yourself. I am new to a
    WinForms calendar component, I feel so helpless on many problems even I'd read many tutorials. This question on the
    calendar date selection did me a great favor. Cheers.

  • I am trying to sync music from my iTunes library on my iMac to my iPhone. I only want selected music but I'm getting unwanted songs. How can I delete those songs on my iPhone or how can I prevent these unwanted songs that have not been selected from appea

    I am trying to sync music from my iTunes library on my iMac to my iPhone. I only want selected music but I'm getting unwanted songs. How can I delete those songs on my iPhone or how can I prevent these unwanted songs that have not been selected from appearing on my iPhone? Help!

    http://support.apple.com/kb/HT1296

  • I bought macbook air in feb 2013. if it is fully charged it only works for 3 hours while it should work for 7 hours. i have selected allow application from anywhere. does it affects ?

    i bought macbook air in feb 2013. if it is fully charged it only works for 3 hours while it should work for 7 hours. i have selected allow application from anywhere. does it affects ?

    vishalss180 wrote:
    should i change the battry ??
    No need to change the battery.
    vishalss180 wrote:
    i have selected allow application from anywhere. does it affects ?
    No.
    Maximize Runtime / Tips for maximizing your battery charge
    http://support.apple.com/kb/HT1446
    http://support.apple.com/kb/TS1473
    A new Mac comes with 90 days of free tech support from AppleCare.
    AppleCare: 1-800-275-2273

  • Hi, I tried to create a slideshow that contain more than 500 photos. Now, trying to open / execute / select the slideshow, iPhoto hangs with the spinning coloured wheel and I have only to force the deletion from System Preference. Any suggestion?

    Hi, I tried to create a slideshow that contain more than 500 photos. Now, trying to open / execute / select the slideshow, iPhoto hangs with the spinning coloured wheel and I have only to force the deletion from System Preference. I already tried to rebuild the iPhoto Library (all the possible options) and tried to update teh version from 9.4.3 to 9.5 but the problem still persists: is there a way to delete this slideshow without selecting it ? How can I solve the problem, please?
    Kind Regards

    Can you restore your iPhoto Library from a backup version, that was created before you added the slideshow?
    If not, have you tried to rebuild the slideshow with iPhoto Library Manager?
    As described by Terence Devlin here:  Re: iphoto library was created with an unrelased version of iphoto please quit and ugrade library by opening it in iphoto 2 or iphoto 4

  • Old IMAC with 10.5.6 OSX. Forgot Administrator password. Started up from OSX install disc 1 and selected password reset from utilies in Installer. But HD icon doesn't show up. (Only install disc and admin root available:no good). What can I do?

    Old IMAC with 10.5.6 OSX. Forgot Administrator password (which I had already changed.) Followed instructions as per http://support.apple.com/kb/HT1274
    Started up from the original OSX install disc 1 and selected "Password reset" from "utilies" in Installer. But HD icon doesn't show up. (Only install disc and admin root available:no good as the support website underscores: Important: Do not select "System Administrator (root)". This is actually the root user. You should not confuse it with a normal administrator account.).
    What can I do?
    Thanks for your suggestions. Antonio

    Not familiar with that version of OS X but try using Terminal and type in resetpassword. If that brings up a password reset screen is your original username shown?

  • Why can't I select an object from its center?  Direct selecttool will only select bounding box.

    Why can't I select an object from its center?  Direct selecttool will only select bounding box.

    You may have turned on "Object selection by path only" in the "Selection Options".

Maybe you are looking for