Extract link from a HTML file

Just starting out? Need help? Post your questions and find answers here.
User avatar
CONVERT
Enthusiast
Enthusiast
Posts: 130
Joined: Fri May 02, 2003 12:19 pm
Location: France

Post by CONVERT »

Or:

Code: Select all

If Ucase(Trim(Right(res$,4))) <> ".XXX" 
  res$ = "" 
Endif 
to remove eventual space at the end.
PureBasic 6.20 beta 2 (x64) | Windows 10 Pro x64 | Intel(R) Core(TM) i7-8700 CPU @ 3.20Ghz 16 GB RAM, SSD 500 GB, PC locally assembled.
Come back to 6.11 LTS 64 bits because of an issue with #PB_ComboBox_UpperCase in ComboBoxGadget() (Oct. 10, 2024).
bidanh00co
User
User
Posts: 56
Joined: Thu Jul 07, 2005 10:06 am

Post by bidanh00co »

THank CONVERT very much !

BUt I have this question. IF we extract the string which begin with "Http://" and end with " . It will miss many links, such as:

<p><embed SRC=http://media.company.com/content/file.wmv WIDTH=400 HEIGHT=300 AUTOPLAY=true CONTROLLER=true LOOP=false ></p>


You see, that link begin with http:// but end with specify extension (wmv).
So, I think we have to change all, it must be begin "http://" and end with "wmv" or "avi" or "mpg" or.... Could it be a list of extension files ??

CONVERT ? Do you have any idea ??
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

Post by rsts »

Why not post detailed specs and ask someone to write the program for you. Or offer to pay them?
ricardo
Addict
Addict
Posts: 2438
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Post by ricardo »

bidanh00co wrote:THank CONVERT very much !

BUt I have this question. IF we extract the string which begin with "Http://" and end with " . It will miss many links, such as:

<p><embed SRC=http://media.company.com/content/file.wmv WIDTH=400 HEIGHT=300 AUTOPLAY=true CONTROLLER=true LOOP=false ></p>


You see, that link begin with http:// but end with specify extension (wmv).
So, I think we have to change all, it must be begin "http://" and end with "wmv" or "avi" or "mpg" or.... Could it be a list of extension files ??

CONVERT ? Do you have any idea ??
Data Mining...

If you are trying to parse a site an extract all the links of a kind, usually the links (or any other data) appears in some way all the time. You have to find that patterns to be able to catch all that info (in your case, media links and maybe the associated name, duration, etc).
ARGENTINA WORLD CHAMPION
bidanh00co
User
User
Posts: 56
Joined: Thu Jul 07, 2005 10:06 am

Post by bidanh00co »

To rsts :
- IF I want to make a commercial program, I will ask someone to make it and pay them. I know, I know .....
But I want to learn PB, I have ideas, and I want to know how to solve it, sometime I got trouble (many times :) ... then I have to post questions here. Some of them are silly.

To Ricardo:
- Thank you. Now I have a way to extract all kind of links include Streams, Script Hidden.
dagcrack
Addict
Addict
Posts: 1868
Joined: Sun Mar 07, 2004 8:47 am
Location: Argentina
Contact:

Post by dagcrack »

RSTS: The guy is learning, sometimes it can look quite stupid when someone gives them the solution and they ask how to do this certain thing (when its just in front of their noses) but they are beginners, they began the programming course... For sure we all passed through that, and still pass through on some aspects (You never stop learning new things).

If they want to become good programmers, they shouldnt ask that much and be hard-minded, read the manual as much as possible (totally once, twice. and check it up every time he needs). And find the solution for their problems, at least try to, very hard, never giving up... but well, theres the other kind of guys, who gets purebasic, they open the manual, they dont care about reading it because they think they can do well with out "wasting" all that time reading that "unneded information" and they TRY to make something, of course, they fail, they always do. (they are beginners, no programming experience...) their first failure/error was to think that reading a manual was a waste of time!, and their second error was to steal my mashed potatoes... :? :?




Well don't get me wrong, im not talking about you bidanh00co here.. just a global comment / point of view. Oh and theres also another kind of guys, that... Okey, I'll shut up :lol: :lol:.


bidanh00co: read up the manual, but not all of it, for now read about the functions that were used on the provided examples for your issue. you'll find out what each function does and how to use them correctly.

And just as a friendly comment: I suggest you not to aim very distant (no big projects for starting), aim closer. work on very simple stuff.. even on "debug programs" (thats how I call them, whenever im teaching someone to programm in PureBasic, I always suggest them to try out the various functions of PureBasic on debug programs, that is, use as output the debug window, and just that. no graphical interface, not even a console program. this is the fastest (time-wise) way of trying out something. It might sound stupid now, but trust me its useful to know about this, its good for a beginner. So, use the debugger, use the Debug function... and get to try the power of PB...!

(By the way, for a better programming experience: use jaPBe (its another IDE) although now the new PB's ide is nice, but, some of us still use jaPBe because of some of its comfy features, and either way, it already does the job for me so why changing right now? hehe -tsk tsk, auto-indent is useful sometimes! please add it to the new IDE! thats something I miss- Wait, perhaps.. if the plugins module was more expanded, we could programm inside features of the IDE, I mean, add features by ourselves if we want/need to like the auto-indent... Although as it is right now there shouldnt be trouble to do it, but... It would be nice if we could add the plugin actions to the popupmenu (right click) of the IDE, etc.. ).
! Black holes are where God divided by zero !
My little blog!
(Not for the faint hearted!)
User avatar
CONVERT
Enthusiast
Enthusiast
Posts: 130
Joined: Fri May 02, 2003 12:19 pm
Location: France

Post by CONVERT »

The most part of the pleasure of programming is in looking actively for solutions, not in receiving them completely passively.

bidanh00co, you have some examples. Do not use them, but rewrite them with your own logic.

These examples are here only to show you some directions, and help you understanding how to use PB. Compare the examples with the documentation (F1 on the instructions), and understand how to use the help. So, you'll be able to use other unknown instructions and to create new solutions by yourself. Here is the main pleasure.

May be your problem is not in using PB instructions, but how to find a solution with whatever language you use. So, first, write the solution in your native language, only with your logic, without thinking of PB. After, it will be much easier.
PureBasic 6.20 beta 2 (x64) | Windows 10 Pro x64 | Intel(R) Core(TM) i7-8700 CPU @ 3.20Ghz 16 GB RAM, SSD 500 GB, PC locally assembled.
Come back to 6.11 LTS 64 bits because of an issue with #PB_ComboBox_UpperCase in ComboBoxGadget() (Oct. 10, 2024).
bidanh00co
User
User
Posts: 56
Joined: Thu Jul 07, 2005 10:06 am

Post by bidanh00co »

To DAGCRACK:

Thank dagcrack for your long-advice.

I'm not living in a english using country (so that the way I use english is not good), I'm even not a Informatics Student, I'm in Business related University.

I spend a lot of time to read over PB's Help file (many thing I don't understand).
I'm self learning C/C++ by reading e-book, not study at any programming course.

The most I get is learning from all of you, from many examples.

I'm sorry for my silly questions or sometimes I make a question without think of it much. I have to say that, I make a small program, it got something that I can't touch, I have to post here and Of course, I want to get the nearest answer. (maybe this make you not pleasure).

TO CONVERT:
Thank you very much. Your codes are clear, easy understand :)
User avatar
CONVERT
Enthusiast
Enthusiast
Posts: 130
Joined: Fri May 02, 2003 12:19 pm
Location: France

Post by CONVERT »

I spend a lot of time to read over PB's Help file (many thing I don't understand).
If you find something in the Help you do not understand, try to ask on the forum. It is more important to obtain general keys allowing you to be autonomous.
PureBasic 6.20 beta 2 (x64) | Windows 10 Pro x64 | Intel(R) Core(TM) i7-8700 CPU @ 3.20Ghz 16 GB RAM, SSD 500 GB, PC locally assembled.
Come back to 6.11 LTS 64 bits because of an issue with #PB_ComboBox_UpperCase in ComboBoxGadget() (Oct. 10, 2024).
Post Reply