Jump to content

filter .txt file with urls


Recommended Posts

Hi guys ive got a problem.

I got a programm which is downloading a source code from an webpage and is saving it to an .txt file.

After that it is filtering the .txt file for my specific url´s by StringInStr. 

then I get my urls in the final txt file but it gives me out the links like that 
<p>https...</p> </div>

how can I delete the rest expeted the links?

here is the code it selfe:

Local $aArray = FileReadToArray($sFile1)
    For $element in $aArray
        If StringInStr($element, "https://...") Then FileWriteLine($sFile2, $element)
    Next

 

Link to comment
Share on other sites

#Include <Array.au3>

$text = FileRead("Links.txt")

$aRes = StringRegExp($text, '(?:http|rtmp)s?[^"\r\n]+', 3)
_ArrayDisplay($aRes)
FileWrite("Slotomania Links",$aRes)

is giving me out nothing

if im going to leave out the file write part im getting all the links displayed but at the end there is still the </p> </div> so that the link looks like that:

https:....gifts&amp;hc_location=ufi</p> </div>

Edited by lordsocke
Link to comment
Share on other sites

Post the text in your file. 

Spoiler

My Contributions

Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language.

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Link to comment
Share on other sites

You have a file with some text. And you want to strip some urls from that text. So i just want to see that text so that i can see if i can help you. Is that clear ?

Spoiler

My Contributions

Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language.

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Link to comment
Share on other sites

#Include <Array.au3>

$text = FileRead("Links.txt")

$aRes = StringRegExp($text, '(?:http|rtmp)s?[^"\r\n]+', 3)
_ArrayDisplay($aRes)
FileWrite("Slotomania Links",$aRes)

is giving me out nothing

if im going to leave out the file write part im getting all the links displayed but at the end there is still the </p> </div> so that the link looks like that:

https:....gifts&amp;hc_location=ufi</p> </div>

You could just run a stringreplace, look for the stuff you want to remove and remove it with '' or ""

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...