How to extract data from table ?

Discussions and Tech Support related to website data extraction, screen scraping and data mining using iMacros.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
newmember
Posts: 20
Joined: Mon Mar 17, 2014 7:01 am

How to extract data from table ?

Post by newmember » Thu Mar 24, 2016 10:05 am

Hello,

Code: Select all

URL GOTO=https://chinesepod.com/tools/glossary/entry/ugly

TAG POS=1 TYPE=TD ATTR=TXT:* EXTRACT=TXT
TAG POS=1 TYPE=A ATTR=TXT:Download&&HREF:* EXTRACT=HREF

TAG POS=2 TYPE=TD ATTR=TXT:* EXTRACT=TXT
TAG POS=2 TYPE=A ATTR=TXT:Download&&HREF:* EXTRACT=HREF

TAG POS=3 TYPE=TD ATTR=TXT:* EXTRACT=TXT
TAG POS=3 TYPE=A ATTR=TXT:Download&&HREF:* EXTRACT=HREF

SAVEAS TYPE=EXTRACT FOLDER=E:\ FILE=pinyin.csv
I use this code to extract text and URL but it always extract wrong URL.
Image
So the text doesn't match the URL. How to fix it ? Thank you very much
andyh2003
Posts: 9
Joined: Thu Sep 17, 2015 9:26 am

Re: How to extract data from table ?

Post by andyh2003 » Thu Mar 24, 2016 10:20 am

try changing the TAG position by 1 or 2...


TAG POS=1 TYPE=TD ATTR=TXT:* EXTRACT=TXT
TAG POS=2 TYPE=A ATTR=TXT:Download&&HREF:* EXTRACT=HREF


or


TAG POS=1 TYPE=TD ATTR=TXT:* EXTRACT=TXT
TAG POS=3 TYPE=A ATTR=TXT:Download&&HREF:* EXTRACT=HREF
newmember
Posts: 20
Joined: Mon Mar 17, 2014 7:01 am

Re: How to extract data from table ?

Post by newmember » Thu Mar 24, 2016 11:42 am

Yes. It worked :)
chivracq
Posts: 9175
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: How to extract data from table ?

Post by chivracq » Thu Mar 24, 2016 1:08 pm

newmember wrote:Hello,

Code: Select all

URL GOTO=https://chinesepod.com/tools/glossary/entry/ugly

TAG POS=1 TYPE=TD ATTR=TXT:* EXTRACT=TXT
TAG POS=1 TYPE=A ATTR=TXT:Download&&HREF:* EXTRACT=HREF

TAG POS=2 TYPE=TD ATTR=TXT:* EXTRACT=TXT
TAG POS=2 TYPE=A ATTR=TXT:Download&&HREF:* EXTRACT=HREF

TAG POS=3 TYPE=TD ATTR=TXT:* EXTRACT=TXT
TAG POS=3 TYPE=A ATTR=TXT:Download&&HREF:* EXTRACT=HREF

SAVEAS TYPE=EXTRACT FOLDER=E:\ FILE=pinyin.csv
I use this code to extract text and URL but it always extract wrong URL.
Image
So the text doesn't match the URL. How to fix it ? Thank you very much
CIM...! :mrgreen:
(Wondering btw if you are still using Pale Moon (like me)...)
andyh2003 wrote:try changing the TAG position by 1 or 2...

Code: Select all

TAG POS=1 TYPE=TD ATTR=TXT:* EXTRACT=TXT
TAG POS=2 TYPE=A ATTR=TXT:Download&&HREF:* EXTRACT=HREF
or

Code: Select all

TAG POS=1 TYPE=TD ATTR=TXT:* EXTRACT=TXT
TAG POS=3 TYPE=A ATTR=TXT:Download&&HREF:* EXTRACT=HREF
newmember wrote:Yes. It worked :)
Yep, but using Relative Positioning would probably be more reliable.
If any HTML Element is added on the Page with a Link, you will again extract the wrong URL...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
Post Reply