Sign in to follow this  
Followers 0
langthang084

How to copy a part text from website?

5 posts in this topic

#1 ·  Posted (edited)

I want to copy a part text from website, ex: http://www.bbc.com/sport/0/football/28347957. So how to select text from the start "Van Gaal's major tittles" to the end ". When you repeat that, everybody thinks like that" then copy with the table is removed.

Could anyone help me!

Thanks!

Edited by langthang084

Share this post


Link to post
Share on other sites



Are there several articles that start and end with that? What do you mean by then copy with the table is removed? Do you want to print this to a text file or make it a string variable?


Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Share this post


Link to post
Share on other sites

yeah. I want to save from some web with the same start and end then save as document. The table is remove because i want to change form like that: 

   Domestic leagues: ........

   Champions League: ......

   Uefa Cup: ......

Share this post


Link to post
Share on other sites

Its not pretty but I was able to:

1. Goto the website

2. Select all text (CTRL + A)

3. Copy selected text (Ctrl  + C)

4. Open notepad

5. Paste the data (Ctrl + V)

6. Search for Van Gaal's major titles (CTRL + F)

7. Goto the beginning of the line (Home Key)

8. Hold down shift and the ctrl + Home to select all the text above the line "Van Gaal's major titles"

9. Hit delete to remove selected data

10. Search for 'When you repeat that, everybody thinks like that' (Ctrl + F)

11. Goto the end of the line (End key)

12. Select everything under the end of the last line (Shift + CTRL + End)

13. Delete the selected data and save the text file.

Hope this helps

1 person likes this

Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Share this post


Link to post
Share on other sites

Maybe playing with regex (raw)

#Include <Array.au3>

$txt = BinaryToString(InetRead("http://www.bbc.com/sport/0/football/28347957"))
$res = StringRegExp($txt, '(?s)<div class="data-table-outer">(.*?)</tbody>', 3)

$td = StringRegExp($res[0], '(?s)((?:<h2.*?/h2>)|(?:<td.*?/td>))', 3)
$final = ""
For $i = 0 to ubound($td)-1
   $final &= StringStripWs(StringRegExpReplace($td[$i], '(?s)(<.*?>)|(&#039;)', ""), 3) & @crlf
Next
Msgbox(0,"", $final)

Share this post


Link to post
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
Sign in to follow this  
Followers 0