| |
|
|
- Seite 1 - |
|
 Frank Abbing | Ein kleines Utility, um Links aus HTML-Codes zu extrahieren. |
|
|
| |
|
|
|
| |
|
- Seite 2 - |
|
 Frank Abbing | Ah, verstanden! Ist also kein echtes Html. Na ja, ich lass es jetzt trotzdem drin. Hast du auch einen Testbericht? |
|
|
| |
|
|
|
 | Jaja, das funktioniert schon, aber ich bitte Dich... 
Schade das OCX zur Zeit nicht funktioniert, normalerweise durch die Nodes eines "html"-Controls hüpfen und die "links" mitnehmen.
Mit XProfan würde ich das so machen:
{$cleq}
#include download.inc
cls
strings myLinks=arr.aHrefsFromUrl("https://frabbing.de/links.html")
whileLoop sizeOf(myLinks) {
print myLinks[loop-1]
}
print "fertig"
waitinput
end
arr.aHrefsFromUrl(string _url){
strings links=explode(upper$(dw.get(_url)),"<A "),
tmp,
ret
string s
whileLoop 0,sizeOf(links)-1 {
tmp=explode(links[loop],"HREF=")
select sizeOf(tmp)
caseof 0,1 : continue
otherWise
s=substr$(tmp[1],2,mid$(tmp[1],1,1))
case s=="" : continue
ret[sizeOf(ret)]=s
endSelect
}
return ret
}
und das klappt auch ganz gut, solange sich die Angaben innerhalb " oder befinden.
Aber das kann man ja leicht und ewig erweitern.
URLs sind normalerweise case-sensitive, das Beispiel achtet darauf nicht. |
|
|
| |
|
|
|
 Frank Abbing |
URLs sind normalerweise case-sensitive, das Beispiel achtet darauf nicht.
Ja, darum auch unbrauchbar. 
Ich sagte ja, ist nur ein kleines Utility. Aber für diese Zwecke ausreichend. Dank dir für den Test! |
|
|
| |
|
|
|
 | Ne URL eingeben können wäre schön... |
|
|
| |
|
|
|
 Frank Abbing | Ja, to be continued.  |
|
|
| |
|
|
|
 | Die Variante hier ist case-sensitive:
{$cleq}
#include download.inc
cls
strings myLinks=arr.aHrefsFromUrl("https://frabbing.de/links.html")
whileLoop sizeOf(myLinks) {
print myLinks[loop-1]
}
print "fertig"
waitinput
end
arr.aHrefsFromUrl(string _url){
strings links=explode(translate$(translate$(dw.get(_url),"<a ","<A ")," href="," HREF="),"<A "),
tmp,
ret
string s
whileLoop 0,sizeOf(links)-1 {
tmp=explode(links[loop],"HREF=")
select sizeOf(tmp)
caseof 0,1 : continue
otherWise
s=substr$(mid$(tmp[1],1,512),2,mid$(tmp[1],1,1))
case s=="" : continue
ret[sizeOf(ret)]=s
endSelect
}
return ret
}
Man übergibt einfach an die Funktion eine URL, und erhält ein Stringarray zurück mit den Links. |
|
|
| |
|
|
|
 Frank Abbing | Lässt sich nicht starten, dein Code. XPSE meldet ne Masse Fehler, trotz dass ich grad die aktuelle download.inc geladen hab. Die Rückgabelinks in der Editbox finde ich auch viel praktischer. |
|
|
| |
|
|
| |
|
- Seite 3 - |
|
|
 | Hm gug mal läuft ohne Probleme durch:
XProfan 11.0.1.7ze Precompiler & SE [XPSE] Copyright (C) 2004-2008 XProfan.Com, built DE. Datei : c:dev1.xprf (121) Stats : If[15], Proc[7], Klassen[0], Macros[0] Runtime : "prfrun32.exe", gefunden Kompiler : "profcomp.exe", gefunden Fertig (47ms), beliebige Taste zum beenden oder Kompileroption {$Q}uiet um ohne Nachfrage zu beenden. [C]ompile [L]ink [R]unPrc Run[E]xe [S]ource [H]ilfe XPSE:> Kompilieren: Code: 0 [erfolg] (2606 byte pcode) XPSE:> Linken: Code: 0 [erfolg] (1027 KB exe) XPSE:> Ausfuehren: Code: 0 [erfolg] XPSE:>  |
|
|
| |
|
|
|
 Frank Abbing | Guck mal, läuft gar nicht durch, warum auch immer. |
|
|
| |
|
|
|
 | Drück mal W dann ist der Report wenigstens komplett - so sieht man ja garnichts. (auch keine xpse Versionsnummer)
Du hast aber bestimmt nur einen alten XPSE.
Kannst ja auch Profan²5.0 zuschalten und schauen obs klappt.  |
|
|
| |
|
|
|
 Frank Abbing | Hast recht, nach Update ging es. Aber dadurch entstanden andere Probleme, die ich in einem neuen Thread näher erklär(t)e. |
|
|
| |
|
|
|
 Frank Abbing | Neue Version (1.02) hochgeladen. Seiten können geladen und kopiert werden. |
|
|
| |
|
|